home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_enscript.idb / usr / freeware / share / enscript / enscript.st.z / enscript.st
Encoding:
Text File  |  1998-10-28  |  134.0 KB  |  5,833 lines

  1. /*
  2.  * States definitions file for GNU Enscript.
  3.  * Copyright (c) 1997-1998 Markku Rossi.
  4.  * Author: Markku Rossi <mtr@iki.fi>
  5.  *
  6.  * The latest version of this file can be downloaded from URL:
  7.  *
  8.  *     http://www.iki.fi/~mtr/genscript/enscript.st
  9.  */
  10.  
  11. /*
  12.  * This file is part of GNU enscript.
  13.  *
  14.  * This program is free software; you can redistribute it and/or modify
  15.  * it under the terms of the GNU General Public License as published by
  16.  * the Free Software Foundation; either version 2, or (at your option)
  17.  * any later version.
  18.  *
  19.  * This program is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the
  22.  * GNU General Public License for more details.
  23.  *
  24.  * You should have received a copy of the GNU General Public License
  25.  * along with this program; see the file COPYING.  If not, write to
  26.  * the Free Software Foundation, 59 Temple Place - Suite 330,
  27.  * Boston, MA 02111-1307, USA.
  28.  */
  29.  
  30. /*
  31.  * $Id: enscript.st,v 1.76 1998/07/01 08:41:23 mtr Exp $
  32.  */
  33.  
  34. /*
  35.  * Guildelines for writing new highlighting rules for the GNU Enscript.
  36.  *
  37.  * - all pretty-printing states should have a document comment like this:
  38.  *
  39.  *   /**
  40.  *    * Name: c
  41.  *    * Description: C programming language.
  42.  *    * Author: Author Name <author@email.address>
  43.  *    * ...
  44.  *
  45.  *   It is used by enscript's --help-pretty-print option to print
  46.  *   description about supported pretty-printing modes.
  47.  *
  48.  * - BEGIN and END rules must call header() and trailer() subroutines:
  49.  *
  50.  *   state c
  51.  *   {
  52.  *     BEGIN {
  53.  *     header ();
  54.  *     }
  55.  *     END {
  56.  *     trailer ();
  57.  *     }
  58.  *
  59.  * - each state and possible help-states should have LANGUAGE_SPECIALS rule:
  60.  *
  61.  *     LANGUAGE_SPECIALS {
  62.  *     language_print ($0);
  63.  *     }
  64.  *
  65.  * - all printing should be done with the language_print() procedure
  66.  *   instead of the print() primitive.
  67.  *
  68.  * These rules ensures that enscript's --help-pretty-print option works
  69.  * and that the many2html utility script can convert all the
  70.  * --pretty-print supported languages to HTML.
  71.  */
  72.  
  73. /* This script needs at least this version of the States program. */
  74. prereq ("1.5.0");
  75.  
  76. /*
  77.  * Constants, fonts, etc.
  78.  */
  79.  
  80. debug = "0";
  81.  
  82. /* Boolean values. */
  83. true = 1;
  84. false = 0;
  85.  
  86. font_spec = "Courier@10";
  87.  
  88. /* These components are resolved from <font_spec>. */
  89. font = "";
  90. ptsize = "";
  91.  
  92. /*
  93.  * Highlight levels.  Possible values are:
  94.  * - none    no highlighting
  95.  * - light    light highlighting (comments and highlights)
  96.  * - heavy    give all
  97.  */
  98. hl_level = "heavy";
  99.  
  100. /*
  101.  * Colormodel.    Possible values are:
  102.  * - blackwhite        no colors, just black and white
  103.  * - emacs        similar to emacs' font lock highlighting
  104.  */
  105. colormodel = "blackwhite";
  106.  
  107. /*
  108.  * Target language.  Possible values are:
  109.  * - enscript        generate enscript special escapes
  110.  * - html        generate HTML
  111.  * - overstrike        generate overstrike (line printers, less)
  112.  * - texinfo        generate Texinfo
  113.  * - rtf                generate Rich Text Format (rtf - MS Word, WordPerfect)
  114.  *                      This code can be suched into MS Word or PowerPoint
  115.  *                      for a pretty version of the code
  116.  */
  117. language = "enscript";
  118.  
  119. /*
  120.  * How many input files we have.
  121.  */
  122. num_input_files = "1";
  123. current_input_file = 0;
  124.  
  125. /*
  126.  * Document title.
  127.  */
  128. document_title = "Enscript Output";
  129.  
  130.  
  131. /*
  132.  * Color definitions.
  133.  */
  134.  
  135. cindex = 0;
  136. rgb_values = list ();
  137.  
  138. sub define_color (name, r, g, b)
  139. {
  140.   rgb_values[cindex] = list (name, r, g, b);
  141.   cindex = cindex + 1;
  142. }
  143.  
  144. sub color_index (name)
  145. {
  146.   local i;
  147.  
  148.   for (i = 0; i < length (rgb_values); i = i + 1)
  149.     if (strcmp (rgb_values[i][0], name) == 0)
  150.       return i;
  151.  
  152.   return -1;
  153. }
  154.  
  155. sub language_color (name)
  156. {
  157.   local idx;
  158.  
  159.   idx = color_index (name);
  160.   if (idx < 0)
  161.     panic ("unknown color `", name, "'");
  162.  
  163.   /*
  164.    * The map_color() subroutine is language specific and defined in
  165.    * *_faces() subroutine.
  166.    */
  167.   map_color (rgb_values[idx][1], rgb_values[idx][2], rgb_values[idx][3]);
  168. }
  169.  
  170. /* RGB definitions for colors.    These are borrowed from X's rgb.txt file. */
  171.  
  172. define_color ("black",            0, 0, 0);
  173. define_color ("blue",            0, 0, 255);
  174. define_color ("cadet blue",        95, 158, 160);
  175. define_color ("dark goldenrod",        184, 134, 11);
  176. define_color ("dark olive green",    85, 107, 47);
  177. define_color ("firebrick",        178, 34, 34);
  178. define_color ("forest green",        34, 139, 34);
  179. define_color ("orchid",            218, 112, 214);
  180. define_color ("purple",            160, 32, 240);
  181. define_color ("rosy brown",        188, 143, 143);
  182.  
  183. define_color ("DarkSeaGreen",        139, 179, 129);
  184. define_color ("Goldenrod",        237, 218, 116);
  185. define_color ("Aquamarine",        67, 183, 186);
  186. define_color ("SeaGreen2",        100, 233, 134);
  187. define_color ("Coral",            247, 101,  65);
  188. define_color ("DarkSlateGray1",        154, 254, 255);
  189.  
  190.  
  191. /*
  192.  * General helpers.
  193.  */
  194.  
  195. sub debug (msg)
  196. {
  197.   if (debug_level)
  198.     print ("DEBUG: ", msg, "\n");
  199. }
  200.  
  201. sub is_prefix (prefix, string)
  202. {
  203.   return strncmp (prefix, string, length (prefix)) == 0;
  204. }
  205.  
  206. sub strchr (string, ch)
  207. {
  208.   local len = length (string), i;
  209.  
  210.   for (i = 0; i < len; i = i + 1)
  211.     if (string[i] == ch)
  212.       return i;
  213.  
  214.   return -1;
  215. }
  216.  
  217. sub need_version (major, minor, beta)
  218. {
  219.   local r, v, i;
  220.  
  221.   regmatch (version, (/([0-9]+)\.([0-9]+)\.([0-9]+)/));
  222.   v = list (int ($1), int ($2), int ($3));
  223.   r = list (major, minor, beta);
  224.  
  225.   for (i = 0; i < 3; i = i + 1)
  226.     if (v[i] > r[i])
  227.       return 1;
  228.     else if (v[i] < r[i])
  229.       return 0;
  230.  
  231.   /* Exact match. */
  232.   return 1;
  233. }
  234.  
  235. /* Highlight types which match expression <re> from string <data>. */
  236. sub highlight_types (data, re)
  237. {
  238.   local match_len;
  239.  
  240.   while (regmatch (data, re))
  241.     {
  242.       language_print ($B);
  243.       type_face (true);
  244.       language_print ($0);
  245.       type_face (false);
  246.  
  247.       match_len = length ($B, $0);
  248.  
  249.       data = substring (data, match_len, length (data));
  250.     }
  251.  
  252.   language_print (data);
  253. }
  254.  
  255.  
  256. /*
  257.  * Output face definitions for different target languages.
  258.  */
  259.  
  260. sub enscript_faces ()
  261. {
  262.   /* RGB -> PostScript color mapper function. */
  263.   sub map_color (r, g, b)
  264.     {
  265.       return sprintf ("%f %f %f", r div 255.0, g div 255.0, b div 255.0);
  266.     }
  267.  
  268.   /* No language special characters. */
  269.   LANGUAGE_SPECIALS = 0;
  270.  
  271.   sub language_print (str)
  272.     {
  273.       print (str);
  274.     }
  275.  
  276.   sub header ()
  277.     {
  278.       /* Nothing here. */
  279.     }
  280.  
  281.   sub trailer ()
  282.     {
  283.       /* Nothing here. */
  284.     }
  285.  
  286.   sub font (name)
  287.     {
  288.       print ("\0font{", name, "@", ptsize, "}");
  289.     }
  290.  
  291.   sub color (name)
  292.     {
  293.       print ("\0color{", name, "}");
  294.     }
  295.  
  296.   sub default ()
  297.     {
  298.       print ("\0font{default}");
  299.       if (color)
  300.     print ("\0color{default}");
  301.     }
  302.  
  303.   sub bold (on)
  304.     {
  305.       if (on)
  306.     {
  307.       font (bold_font);
  308.       if (color)
  309.         color (bold_color);
  310.     }
  311.       else
  312.     default ();
  313.     }
  314.  
  315.   sub italic (on)
  316.     {
  317.       if (on)
  318.     {
  319.       font (italic_font);
  320.       if (color)
  321.         color (italic_color);
  322.     }
  323.       else
  324.     default ();
  325.     }
  326.  
  327.   sub bold_italic (on)
  328.     {
  329.       if (on)
  330.     {
  331.       font (bold_italic_font);
  332.       if (color)
  333.         color (bold_italic_color);
  334.     }
  335.       else
  336.     default ();
  337.     }
  338.  
  339.   sub comment_face (on)
  340.     {
  341.       if (on)
  342.     {
  343.       font (comment_face_font);
  344.       if (color)
  345.         color (comment_face_color);
  346.     }
  347.       else
  348.     default ();
  349.     }
  350.  
  351.   sub function_name_face (on)
  352.     {
  353.       if (on)
  354.     {
  355.       font (function_name_face_font);
  356.       if (color)
  357.         color (function_name_face_color);
  358.     }
  359.       else
  360.     default ();
  361.     }
  362.  
  363.   sub variable_name_face (on)
  364.     {
  365.       if (on)
  366.     {
  367.       font (variable_name_face_font);
  368.       if (color)
  369.         color (variable_name_face_color);
  370.     }
  371.       else
  372.     default ();
  373.     }
  374.  
  375.   sub keyword_face (on)
  376.     {
  377.       if (on)
  378.     {
  379.       font (keyword_face_font);
  380.       if (color)
  381.         color (keyword_face_color);
  382.     }
  383.       else
  384.     default ();
  385.     }
  386.  
  387.   sub reference_face (on)
  388.     {
  389.       if (on)
  390.     {
  391.       font (reference_face_font);
  392.       if (color)
  393.         color (reference_face_color);
  394.     }
  395.       else
  396.     default ();
  397.     }
  398.  
  399.   sub string_face (on)
  400.     {
  401.       if (on)
  402.     {
  403.       font (string_face_font);
  404.       if (color)
  405.         color (string_face_color);
  406.     }
  407.       else
  408.     default ();
  409.     }
  410.  
  411.   sub builtin_face (on)
  412.     {
  413.       if (on)
  414.     {
  415.       font (builtin_face_font);
  416.       if (color)
  417.         color (builtin_face_color);
  418.     }
  419.       else
  420.     default ();
  421.     }
  422.  
  423.   sub type_face (on)
  424.     {
  425.       if (on)
  426.     {
  427.       font (type_face_font);
  428.       if (color)
  429.         color (type_face_color);
  430.     }
  431.       else
  432.     default ();
  433.     }
  434. }
  435.  
  436.  
  437. sub html_faces ()
  438. {
  439.   /* RGB -> HTML color mapper function. */
  440.   sub map_color (r, g, b)
  441.     {
  442.       return sprintf ("#%02X%02X%02X", r, g, b);
  443.     }
  444.  
  445.   LANGUAGE_SPECIALS = /[<>\&\"]/;
  446.  
  447.   sub language_print (str)
  448.     {
  449.       str = regsuball (str, /\&/, "&");
  450.       str = regsuball (str, /</, "<");
  451.       str = regsuball (str, />/, ">");
  452.       str = regsuball (str, /\"/, """);
  453.       print (str);
  454.     }
  455.  
  456.   sub header ()
  457.     {
  458.       local i;
  459.  
  460.       if (current_input_file == 1)
  461.     {
  462.       print ("<!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n");
  463.       print ("<HTML>\n<HEAD>\n<TITLE>");
  464.       language_print (document_title);
  465.       print ("</TITLE>\n</HEAD>\n",
  466.          color
  467.          ? "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#1F00FF\" ALINK=\"#FF0000\" VLINK=\"#9900DD\">"
  468.          : "<BODY>",
  469.          "\n<A NAME=\"top\">\n");
  470.  
  471.       if (need_version (1, 5, 1) && int (toc) == 1)
  472.         {
  473.           if (length (argv) == 0)
  474.         argv[0] = "(stdin)";
  475.  
  476.           print ("<H1>Contents</H1>\n<OL>\n");
  477.           for (i = 0; i < length (argv); i = i + 1)
  478.         print ("  <LI><A HREF=\"#file", i + 1, "\">", argv[i],
  479.                "</A>\n");
  480.           print ("</OL>\n<HR>\n");
  481.         }
  482.     }
  483.  
  484.       print ("<A NAME=\"file", current_input_file, "\">\n<H1>");
  485.       language_print (filename);
  486.  
  487.       if (int (num_input_files) > 1)
  488.     print (" ", current_input_file, "/", num_input_files);
  489.  
  490.       print ("</H1>\n");
  491.  
  492.       /* Navigation bar. */
  493.       if (need_version (1, 5, 1))
  494.     {
  495.       if (length (argv) >= 2 )
  496.         {
  497.           print ("[<A HREF=\"#top\">top</A>]");
  498.  
  499.           if (current_input_file == 1)
  500.         print ("[prev]");
  501.           else
  502.         print ("[<A HREF=\"\#file", current_input_file - 1,
  503.                "\">prev</A>]");
  504.  
  505.           if (current_input_file == length (argv))
  506.         print ("[next]");
  507.           else
  508.         print ("[<A HREF=\"#file", current_input_file + 1,
  509.                "\">next</A>]");
  510.         }
  511.     }
  512.       else
  513.     print ("[<A HREF=\"#top\">top</A>]");
  514.       print ("\n<PRE>\n");
  515.     }
  516.  
  517.   sub trailer ()
  518.     {
  519.       print ("</PRE>
  520. <HR>\n");
  521.       if (current_input_file == int (num_input_files))
  522.     print ("<ADDRESS>Generated by ",
  523.            "<A HREF=\"http://www.iki.fi/~mtr/genscript/\">",
  524.          substring (version, strchr (version, 'G'), length (version)),
  525.          "</A>.</ADDRESS>
  526. </BODY>
  527. </HTML>\n");
  528.     }
  529.  
  530.   sub color_on (name)
  531.     {
  532.       print ("<FONT COLOR=\"", name, "\">");
  533.     }
  534.  
  535.   sub color_off ()
  536.     {
  537.       print ("</FONT>");
  538.     }
  539.  
  540.   sub bold (on)
  541.     {
  542.       if (on)
  543.     print ("<B>");
  544.       else
  545.     print ("</B>");
  546.     }
  547.  
  548.   sub italic (on)
  549.     {
  550.       if (on)
  551.     print ("<I>");
  552.       else
  553.     print ("</I>");
  554.     }
  555.  
  556.   sub bold_italic (on)
  557.     {
  558.       if (on)
  559.     print ("<B><I>");
  560.       else
  561.     print ("</I></B>");
  562.     }
  563.  
  564.   sub comment_face (on)
  565.     {
  566.       if (on)
  567.     {
  568.       print ("<I>");
  569.       if (color)
  570.         color_on (comment_face_color);
  571.     }
  572.       else
  573.     {
  574.       if (color)
  575.         color_off ();
  576.       print ("</I>");
  577.     }
  578.     }
  579.  
  580.   sub function_name_face (on)
  581.     {
  582.       if (on)
  583.     {
  584.       print ("<B>");
  585.       if (color)
  586.         color_on (function_name_face_color);
  587.     }
  588.       else
  589.     {
  590.       if (color)
  591.         color_off ();
  592.       print ("</B>");
  593.     }
  594.     }
  595.  
  596.   sub variable_name_face (on)
  597.     {
  598.       if (on)
  599.     {
  600.       if (color)
  601.         color_on (variable_name_face_color);
  602.       else
  603.         print ("<B>");
  604.     }
  605.       else
  606.     {
  607.       if (color)
  608.         color_off ();
  609.       else
  610.         print ("</B>");
  611.     }
  612.     }
  613.  
  614.   sub keyword_face (on)
  615.     {
  616.       if (on)
  617.     {
  618.       print ("<B>");
  619.       if (color)
  620.         color_on (keyword_face_color);
  621.     }
  622.       else
  623.     {
  624.       if (color)
  625.         color_off ();
  626.       print ("</B>");
  627.     }
  628.     }
  629.  
  630.   sub reference_face (on)
  631.     {
  632.       if (on)
  633.     {
  634.       print ("<B>");
  635.       if (color)
  636.         color_on (reference_face_color);
  637.     }
  638.       else
  639.     {
  640.       if (color)
  641.         color_off ();
  642.       print ("</B>");
  643.     }
  644.     }
  645.  
  646.   sub string_face (on)
  647.     {
  648.       if (on)
  649.     {
  650.       if (color)
  651.         color_on (string_face_color);
  652.       print ("<B>");
  653.     }
  654.       else
  655.     {
  656.       if (color)
  657.         color_off ();
  658.       print ("</B>");
  659.     }
  660.     }
  661.  
  662.   sub builtin_face (on)
  663.     {
  664.       if (on)
  665.     {
  666.       if (color)
  667.         color_on (builtin_face_color);
  668.       print ("<B>");
  669.     }
  670.       else
  671.     {
  672.       if (color)
  673.         color_off ();
  674.       print ("</B>");
  675.     }
  676.     }
  677.  
  678.   sub type_face (on)
  679.     {
  680.       if (on)
  681.     {
  682.       if (color)
  683.         color_on (type_face_color);
  684.       print ("<B>");
  685.     }
  686.       else
  687.     {
  688.       if (color)
  689.         color_off ();
  690.       print ("</B>");
  691.     }
  692.     }
  693. }
  694.  
  695.  
  696. sub overstrike_faces ()
  697. {
  698.   sub map_color (r, g, b)
  699.     {
  700.       return "";
  701.     }
  702.  
  703.   LANGUAGE_SPECIALS = /./;
  704.  
  705.   sub language_print (str)
  706.     {
  707.       if (italic_flag)
  708.     print (regsuball (str, /[A-Za-z0-9]/, "_\010$0"));
  709.       else if (bold_flag)
  710.     print (regsuball (str, /./, "$0\010$0"));
  711.       else
  712.     print (str);
  713.     }
  714.  
  715.   sub header ()
  716.     {
  717.       bold_flag = 0;
  718.       italic_flag = 0;
  719.     }
  720.  
  721.   sub trailer ()
  722.     {
  723.     }
  724.  
  725.   sub bold (on)
  726.     {
  727.       bold_flag = on;
  728.     }
  729.  
  730.   sub italic (on)
  731.     {
  732.       italic_flag = on;
  733.     }
  734.  
  735.   sub bold_italic (on)
  736.     {
  737.     }
  738.  
  739.   sub comment_face (on)
  740.     {
  741.       italic (on);
  742.     }
  743.  
  744.   sub function_name_face (on)
  745.     {
  746.       bold (on);
  747.     }
  748.  
  749.   sub variable_name_face (on)
  750.     {
  751.       bold (on);
  752.     }
  753.  
  754.   sub keyword_face (on)
  755.     {
  756.       bold (on);
  757.     }
  758.  
  759.   sub reference_face (on)
  760.     {
  761.       bold (on);
  762.     }
  763.  
  764.   sub string_face (on)
  765.     {
  766.       bold (on);
  767.     }
  768.  
  769.   sub builtin_face (on)
  770.     {
  771.       bold (on);
  772.     }
  773.  
  774.   sub type_face (on)
  775.     {
  776.       italic (on);
  777.     }
  778. }
  779.  
  780.  
  781. sub texinfo_faces ()
  782. {
  783.   /* Nop since Texinfo doesn't have colors. */
  784.   sub map_color (r, g, b)
  785.     {
  786.       return "";
  787.     }
  788.  
  789.   LANGUAGE_SPECIALS = /[{}@]/;
  790.  
  791.   sub language_print (str)
  792.     {
  793.       str = regsuball (str, /@/, "@@");
  794.       str = regsuball (str, /{/, "@{");
  795.       str = regsuball (str, /}/, "@}");
  796.       print (str);
  797.     }
  798.  
  799.   sub header ()
  800.     {
  801.       print ("@example\n");
  802.     }
  803.  
  804.   sub trailer ()
  805.     {
  806.       print ("@end example\n");
  807.     }
  808.  
  809.   sub bold (on)
  810.     {
  811.       if (on)
  812.     print ("@strong{");
  813.       else
  814.     print ("}");
  815.     }
  816.  
  817.   sub italic (on)
  818.     {
  819.       if (on)
  820.     print ("@emph{");
  821.       else
  822.     print ("}");
  823.     }
  824.  
  825.   sub bold_italic (on)
  826.     {
  827.     }
  828.  
  829.   sub comment_face (on)
  830.     {
  831.       italic (on);
  832.     }
  833.  
  834.   sub function_name_face (on)
  835.     {
  836.       bold (on);
  837.     }
  838.  
  839.   sub variable_name_face (on)
  840.     {
  841.       bold (on);
  842.     }
  843.  
  844.   sub keyword_face (on)
  845.     {
  846.       bold (on);
  847.     }
  848.  
  849.   sub reference_face (on)
  850.     {
  851.       bold (on);
  852.     }
  853.  
  854.   sub string_face (on)
  855.     {
  856.     }
  857.  
  858.   sub builtin_face (on)
  859.     {
  860.       bold (on);
  861.     }
  862.  
  863.   sub type_face (on)
  864.     {
  865.       if (on)
  866.     print ("@emph{");
  867.       else
  868.     print ("}");
  869.     }
  870. }
  871.  
  872. /*
  873.  * Definition for RTF output
  874.  * Kevin Grover, <grover@wizard.com>
  875.  */
  876.  
  877. sub rtf_color_map()
  878. {
  879.   local i;
  880.  
  881.   print ("{\\colortbl;");
  882.   for (i = 0; i < length (rgb_values); i = i + 1)
  883.     print (sprintf ("\\red%d\\green%d\\blue%d;",
  884.         rgb_values[i][1],
  885.         rgb_values[i][2],
  886.         rgb_values[i][3]));
  887.  
  888.   print ("}\n");
  889.  
  890.   return;
  891. }
  892.  
  893. sub rtf_faces ()
  894. {
  895.   sub language_color (name)
  896.     {
  897.       local idx;
  898.  
  899.       idx = color_index (name);
  900.       if (idx < 0)
  901.     panic ("unknown color `", name, "'");
  902.  
  903.       return sprintf("\\cf%d",idx);
  904.     }
  905.  
  906.   LANGUAGE_SPECIALS = /[\\{}\n]/;
  907.  
  908.   sub language_print (str)
  909.     {
  910.       str = regsuball (str, /\\\\/, "\\\\");
  911.       str = regsuball (str, /{/, "\\{");
  912.       str = regsuball (str, /}/, "\\}");
  913.       str = regsuball (str, /\n/, "\\line\n");
  914.       print (str);
  915.     }
  916.  
  917.   sub header ()
  918.     {
  919.       local i;
  920.  
  921.       if (current_input_file == 1)
  922.     {
  923.       print ("{\\rtf\\ansi\\deff0\n");
  924.       print ("{\\fonttbl{\\f0\\fswiss Courier New;}}\n");
  925.       rtf_color_map();
  926.     }
  927.     }
  928.  
  929.   sub trailer ()
  930.     {
  931.       if (current_input_file == int (num_input_files))
  932.     print ("}\n");
  933.     }
  934.  
  935.   sub color_on (name)
  936.     {
  937.       print ("{", name, " ");
  938.     }
  939.  
  940.   sub color_off ()
  941.     {
  942.       print ("}");
  943.     }
  944.  
  945.   sub bold (on)
  946.     {
  947.       if (on)
  948.     print ("{\\b ");
  949.       else
  950.     print ("}");
  951.     }
  952.  
  953.   sub italic (on)
  954.     {
  955.       if (on)
  956.     print ("{\\i ");
  957.       else
  958.     print ("}");
  959.     }
  960.  
  961.   sub bold_italic (on)
  962.     {
  963.       if (on)
  964.     print ("{\\b\\i ");
  965.       else
  966.     print ("}");
  967.     }
  968.  
  969.   sub comment_face (on)
  970.     {
  971.       if (on)
  972.     {
  973.       print ("{\\i ");
  974.       if (color)
  975.         color_on (comment_face_color);
  976.     }
  977.       else
  978.     {
  979.       if (color)
  980.         color_off ();
  981.       print ("}");
  982.     }
  983.     }
  984.  
  985.   sub function_name_face (on)
  986.     {
  987.       if (on)
  988.     {
  989.       print ("{\\b ");
  990.       if (color)
  991.         color_on (function_name_face_color);
  992.     }
  993.       else
  994.     {
  995.       if (color)
  996.         color_off ();
  997.       print ("}");
  998.     }
  999.     }
  1000.  
  1001.   sub variable_name_face (on)
  1002.     {
  1003.       if (on)
  1004.     {
  1005.       if (color)
  1006.         color_on (variable_name_face_color);
  1007.       else
  1008.         print ("{\\b ");
  1009.     }
  1010.       else
  1011.     {
  1012.       if (color)
  1013.         color_off ();
  1014.       else
  1015.         print ("}");
  1016.     }
  1017.     }
  1018.  
  1019.   sub keyword_face (on)
  1020.     {
  1021.       if (on)
  1022.     {
  1023.       print ("{\\b ");
  1024.       if (color)
  1025.         color_on (keyword_face_color);
  1026.     }
  1027.       else
  1028.     {
  1029.       if (color)
  1030.         color_off ();
  1031.       print ("}");
  1032.     }
  1033.     }
  1034.  
  1035.   sub reference_face (on)
  1036.     {
  1037.       if (on)
  1038.     {
  1039.       print ("{\\b ");
  1040.       if (color)
  1041.         color_on (reference_face_color);
  1042.     }
  1043.       else
  1044.     {
  1045.       if (color)
  1046.         color_off ();
  1047.       print ("}");
  1048.     }
  1049.     }
  1050.  
  1051.   sub string_face (on)
  1052.     {
  1053.       if (on)
  1054.     {
  1055.       if (color)
  1056.         color_on (string_face_color);
  1057.       print ("{\\b ");
  1058.     }
  1059.       else
  1060.     {
  1061.       if (color)
  1062.         color_off ();
  1063.       print ("}");
  1064.     }
  1065.     }
  1066.  
  1067.   sub builtin_face (on)
  1068.     {
  1069.       if (on)
  1070.     {
  1071.       if (color)
  1072.         color_on (builtin_face_color);
  1073.       print ("{\\b ");
  1074.     }
  1075.       else
  1076.     {
  1077.       if (color)
  1078.         color_off ();
  1079.       print ("}");
  1080.     }
  1081.     }
  1082.  
  1083.   sub type_face (on)
  1084.     {
  1085.       if (on)
  1086.     {
  1087.       if (color)
  1088.         color_on (type_face_color);
  1089.       print ("{\\i ");
  1090.     }
  1091.       else
  1092.     {
  1093.       if (color)
  1094.         color_off ();
  1095.       print ("}");
  1096.     }
  1097.     }
  1098. } /* End RTF */
  1099.  
  1100.  
  1101. sub define_faces ()
  1102. {
  1103.   if (strcmp (language, "enscript") == 0)
  1104.     enscript_faces ();
  1105.   else if (strcmp (language, "html") == 0)
  1106.     html_faces ();
  1107.   else if (strcmp (language, "overstrike") == 0)
  1108.     overstrike_faces ();
  1109.   else if (strcmp (language, "texinfo") == 0)
  1110.     texinfo_faces ();
  1111.   else if (strcmp (language, "rtf") == 0)
  1112.     rtf_faces ();
  1113.   else
  1114.     panic ("unknown output language `", language, "'");
  1115. }
  1116.  
  1117.  
  1118. /*
  1119.  * Initializations.
  1120.  */
  1121.  
  1122. start
  1123. {
  1124.   /* Set debug level. */
  1125.   debug_level = int (debug);
  1126.  
  1127.   /* Increment input file count. */
  1128.   current_input_file = current_input_file + 1;
  1129.  
  1130.   /* Resolve fonts. */
  1131.   idx = strchr (font_spec, '@');
  1132.   if (idx < 0)
  1133.     panic ("malformed font spec: `", font_spec, "'");
  1134.  
  1135.   font = substring (font_spec, 0, idx);
  1136.   ptsize = substring (font_spec, idx + 1, length (font_spec));
  1137.  
  1138.   debug (concat ("start: ", font, "@", ptsize));
  1139.  
  1140.   /* Construct bold, italic, etc. fonts for our current body font. */
  1141.   if (is_prefix ("AvantGarde", font))
  1142.     {
  1143.       bold_font = "AvantGarde-Demi";
  1144.       italic_font = "AvantGarde-BookOblique";
  1145.       bold_italic_font = "AvantGarde-DemiOblique";
  1146.     }
  1147.   else if (regmatch (font, /^Bookman|Souvenir/))
  1148.     {
  1149.       bold_font = concat ($0, "-Demi");
  1150.       italic_font = concat ($0, "-LightItalic");
  1151.       bold_italic_font = concat ($0, "-DemiItalic");
  1152.     }
  1153.   else if (regmatch (font, /^(.*)-Roman$/))
  1154.     {
  1155.       bold_font = concat ($1, "-Bold");
  1156.       italic_font = concat ($1, "-Italic");
  1157.       bold_italic_font = concat ($1, "-BoldItalic");
  1158.     }
  1159.   else if (regmatch (font, /^LucidaSans-/))
  1160.     {
  1161.       bold_font = concat (font, "Bold");
  1162.       italic_font = concat (font, "Oblique");
  1163.       bold_italic_font = concat (font, "BoldOblique");
  1164.     }
  1165.   else
  1166.     {
  1167.       bold_font = concat (font, "-Bold");
  1168.       italic_font = concat (font, "-Oblique");
  1169.       bold_italic_font = concat (font, "-BoldOblique");
  1170.     }
  1171.  
  1172.   /* Define output faces. */
  1173.   define_faces ();
  1174.  
  1175.   /* Select colormodel. */
  1176.   if (strcmp (colormodel, "blackwhite") == 0)
  1177.     {
  1178.       color = 0;
  1179.     }
  1180.   else if (strcmp (colormodel, "emacs") == 0)
  1181.     {
  1182.       color = 1;
  1183.       bold_color =            language_color ("black");
  1184.       italic_color =            language_color ("black");
  1185.       bold_italic_color =        language_color ("black");
  1186.       comment_face_color =        language_color ("firebrick");
  1187.       function_name_face_color =    language_color ("blue");
  1188.       variable_name_face_color =    language_color ("dark goldenrod");
  1189.       keyword_face_color =        language_color ("purple");
  1190.       reference_face_color =        language_color ("cadet blue");
  1191.       string_face_color =        language_color ("rosy brown");
  1192.       builtin_face_color =        language_color ("orchid");
  1193.       type_face_color =            language_color ("forest green");
  1194.     }
  1195.   else if (strcmp (colormodel, "ifh") == 0)
  1196.     {
  1197.       color = 1;
  1198.       bold_color =            language_color ("black");
  1199.       italic_color =            language_color ("black");
  1200.       bold_italic_color =        language_color ("black");
  1201.       comment_face_color =        language_color ("DarkSeaGreen");
  1202.       function_name_face_color =    language_color ("Coral");
  1203.       variable_name_face_color =    language_color ("dark goldenrod");
  1204.       keyword_face_color =        language_color ("SeaGreen2");
  1205.       reference_face_color =        language_color ("forest green");
  1206.       string_face_color =        language_color ("Goldenrod");
  1207.       reference_face_color =        language_color ("Aquamarine");
  1208.       builtin_face_color =        language_color ("purple");
  1209.       type_face_color =            language_color ("DarkSlateGray1");
  1210.     }
  1211.   else
  1212.     panic ("unknown color model `", colormodel, "'");
  1213.  
  1214.   /* Select highlight level. */
  1215.   if (strcmp (hl_level, "none") == 0)
  1216.     {
  1217.       comment_face_font =    font;
  1218.       function_name_face_font = font;
  1219.       variable_name_face_font = font;
  1220.       keyword_face_font =    font;
  1221.       reference_face_font =    font;
  1222.       string_face_font =    font;
  1223.       builtin_face_font =    font;
  1224.       type_face_font =        font;
  1225.     }
  1226.   else if (strcmp (hl_level, "light") == 0)
  1227.     {
  1228.       comment_face_font =    italic_font;
  1229.       function_name_face_font = bold_font;
  1230.  
  1231.       if (color)
  1232.     variable_name_face_font = font;
  1233.       else
  1234.     variable_name_face_font = bold_font;
  1235.  
  1236.       keyword_face_font =    bold_font;
  1237.       reference_face_font =    bold_font;
  1238.       string_face_font =    font;
  1239.       builtin_face_font =    font;
  1240.       type_face_font =        font;
  1241.     }
  1242.   else if (strcmp (hl_level, "heavy") == 0)
  1243.     {
  1244.       comment_face_font =    italic_font;
  1245.       function_name_face_font = bold_font;
  1246.  
  1247.       if (color)
  1248.     variable_name_face_font = font;
  1249.       else
  1250.     variable_name_face_font = bold_font;
  1251.  
  1252.       keyword_face_font =    bold_font;
  1253.       reference_face_font =    bold_font;
  1254.       string_face_font =    bold_font;
  1255.       builtin_face_font =    bold_font;
  1256.       type_face_font =        bold_font;
  1257.     }
  1258.   else
  1259.     panic ("unknown highlight level `", hl_level, "'");
  1260.  
  1261.   /* Resolve start state. */
  1262.   if (check_startrules ())
  1263.     debug ("startstate from startrules");
  1264.   if (check_namerules ())
  1265.     debug ("startstate from namerules");
  1266. }
  1267.  
  1268. namerules
  1269. {
  1270.   /\.(c|h)$/                c;
  1271.   /\.(c++|C|H|cpp|cc|cxx)$/        cpp;
  1272.   /\.m$/                objc;
  1273.   /\.(scm|scheme)$/            scheme;
  1274.   /\b\.emacs$|\.el$/            elisp;
  1275.   /\.ad(s|b|a)$/            ada;
  1276.   /\.[Ss]$/                asm;
  1277.   /\.st$/                states;
  1278.   /(M|m)akefile.*/            makefile;
  1279.   /\.tcl$/                tcl;
  1280.   /\.(v|vh)$/                verilog;
  1281.   /\.html?$/                html;
  1282.   /\bChangeLog$/            changelog;
  1283.   /\.(vhd|vhdl)$/            vhdl;
  1284.   /\.(scr|.syn|.synth)$/        synopsys;
  1285.   /\.idl$/                idl;
  1286.   /\.(hs|lhs|gs|lgs)$/            haskell;
  1287.   /\.(pm|pl)$/                perl;
  1288.   /\.(eps|EPS|ps|PS)$/            postscript;
  1289.   /\.py$/                python;
  1290.   /\.js$/                javascript;
  1291.   /\.java$/                java;
  1292.   /\.([Pp][Aa][Ss]|[Pp][Pp]|[Pp])$/    pascal;
  1293.   /\.[fF]$/                fortran;
  1294.   /\.awk$/                awk;
  1295.   /\.sh$/                sh;
  1296.   /\.vba$/                vba;
  1297.   /^.*$/                passthrough;
  1298. }
  1299.  
  1300. startrules
  1301. {
  1302.   /.\010.\010.\010./                    nroff;
  1303.   /-\*- [Cc] -\*-/                    c;
  1304.   /-\*- [Cc]\+\+ -\*-/                    cpp;
  1305.   /-\*- [Aa][Dd][Aa] -\*-/                ada;
  1306.   /-\*- [Aa][Ss][Mm] -\*-/                asm;
  1307.   /-\*- [Oo][Bb][Jj][Cc] -\*-/                objc;
  1308.   /-\*- [Ss][Cc][Hh][Ee][Mm][Ee] -\*-/            scheme;
  1309.   /-\*- [Ee][Mm][Aa][Cc][Ss] [Ll][Ii][Ss][Pp] -\*-/    elisp;
  1310.   /-\*- [Tt][Cc][Ll] -\*-/                tcl;
  1311.   /-\*- [Vv][Hh][Dd][Ll] -\*-/                vhdl;
  1312.   /-\*- [Hh][Aa][Ss][Kk][Ee][Ll][Ll] -\*-/        haskell;
  1313.   /-\*- [Ii][Dd][Ll] -\*-/                idl;
  1314.   /-\*- [Pp][Ee][Rr][Ll] -\*-/                perl;
  1315.   /^#![ \t]*\/.*\/perl/                    perl;
  1316.   /^\04?%!/                        postscript;
  1317.   /^From:/                        mail;
  1318.   /^#![ \t]*(\/usr)?\/bin\/[ngmt]?awk/            awk;
  1319.   /^#![ \t]*(\/usr)?\/bin\/sh/                sh;
  1320. }
  1321.  
  1322.  
  1323. /*
  1324.  * Helper subroutines and states.
  1325.  */
  1326.  
  1327. state match_balanced_block
  1328. {
  1329.   match_balanced_block_start {
  1330.     language_print ($0);
  1331.     match_balanced_block_count = match_balanced_block_count + 1;
  1332.   }
  1333.  
  1334.   match_balanced_block_end {
  1335.     match_balanced_block_count = match_balanced_block_count - 1;
  1336.     if (match_balanced_block_count == 0)
  1337.       return $0;
  1338.  
  1339.     language_print ($0);
  1340.   }
  1341.  
  1342.   LANGUAGE_SPECIALS {
  1343.     language_print ($0);
  1344.   }
  1345. }
  1346.  
  1347. sub match_balanced_block (starter, ender)
  1348. {
  1349.   match_balanced_block_count = 1;
  1350.   match_balanced_block_start = starter;
  1351.   match_balanced_block_end = ender;
  1352.   return call (match_balanced_block);
  1353. }
  1354.  
  1355. state eat_one_line
  1356. {
  1357.   /.*\n/ {
  1358.     language_print ($0);
  1359.     return;
  1360.   }
  1361. }
  1362.  
  1363. /*
  1364.  * Pass all input through handling only output language specific headers
  1365.  * and LANGUAGE_SPECIALS.
  1366.  */
  1367. state passthrough
  1368. {
  1369.   BEGIN {
  1370.     header ();
  1371.   }
  1372.   END {
  1373.     trailer ();
  1374.   }
  1375.   LANGUAGE_SPECIALS {
  1376.     language_print ($0);
  1377.   }
  1378. }
  1379.  
  1380.  
  1381. /*
  1382.  * Describe all known highlight languages.
  1383.  */
  1384.  
  1385. state describe_me
  1386. {
  1387.   / \*$/ {
  1388.   }
  1389.  
  1390.   / \*\\\/.*/ {
  1391.     /* All done. */
  1392.     return;
  1393.   }
  1394.  
  1395.   / \* ?(.*)/ {
  1396.     print ($1);
  1397.   }
  1398. }
  1399.  
  1400. state describe_languages
  1401. {
  1402.   BEGIN {
  1403.     print ("Highlighting is supported for the following languages and file formats:\n");
  1404.   }
  1405.   END {
  1406.     print ("\n");
  1407.   }
  1408.   /^\/\*\*.*$/ {
  1409.     call (describe_me);
  1410.   }
  1411.   /[^\\\/]+/ {
  1412.     /* NOP */
  1413.   }
  1414.   /./ {
  1415.     /* NOP */
  1416.   }
  1417. }
  1418.  
  1419. /*
  1420.  * Create a HTML report of all supported highlighting rules.
  1421.  */
  1422.  
  1423. sub html_annotate_mailtos (str)
  1424. {
  1425.   return regsuball (str, /[-_a-zA-Z0-9\\.]+@[-_a-zA-Z0-9\\.]+/,
  1426.             "<a href=\"mailto:$0\">$0</a>");
  1427. }
  1428.  
  1429. sub html_quote (str)
  1430. {
  1431.   str = regsuball (str, /\&/, "&");
  1432.   str = regsuball (str, /</, "<");
  1433.   str = regsuball (str, />/, ">");
  1434.   str = regsuball (str, /\"/, """);
  1435.   return str;
  1436. }
  1437.  
  1438. sub describe_me_html_print_pending_name ()
  1439. {
  1440.   if (!language_name_pending)
  1441.     return;
  1442.  
  1443.   print ("<p>\n<dl compact>\n<dt><b>Name:</b><dd>",
  1444.      html_quote (language_name), "\n");
  1445.  
  1446.   language_name_pending = 0;
  1447. }
  1448.  
  1449. state describe_me_html
  1450. {
  1451.   / \*$/ {
  1452.   }
  1453.  
  1454.   / \*\\\/.*/ {
  1455.     /* Terminate this state. */
  1456.     describe_me_html_print_pending_name ();
  1457.     print ("</dl>\n");
  1458.     return;
  1459.   }
  1460.  
  1461.   / \* ?(.*)/ {
  1462.     row = $1;
  1463.     if (regmatch (row, /Name:(.*)/))
  1464.       {
  1465.     language_name = $1;
  1466.     language_name_pending = 1;
  1467.       }
  1468.     else if (regmatch (row, /Description:(.*)/))
  1469.       {
  1470.     /* This starts the new language. */
  1471.     title = $1;
  1472.     title = regsub (title, /^[ \t]+/, "");
  1473.     title = regsub (title, /[ \t\\.]+$/, "");
  1474.     print ("<p><li><b>", html_quote (title), "</b><p>\n");
  1475.       }
  1476.     else if (regmatch (row, /([a-zA-Z]+:)(.*)/))
  1477.       {
  1478.     describe_me_html_print_pending_name ();
  1479.     print ("<dt><b>", html_quote ($1), "</b><dd>",
  1480.            html_annotate_mailtos (html_quote ($2)));
  1481.       }
  1482.     else
  1483.       print (html_annotate_mailtos (html_quote (row)));
  1484.   }
  1485. }
  1486.  
  1487. state describe_languages_html
  1488. {
  1489.   BEGIN {
  1490.     title = "Enscript Highlighting Languages And File Formats";
  1491.     print ("<html>\n<head>\n<title>", title, "</title>\n</head>\n<body>\n<h1>",
  1492.        title, "</h1>\n<hr>\n<ul>\n");
  1493.   }
  1494.   END {
  1495.     print ("\n</ul>\n<hr><address>By ", version,
  1496.        "</address>\n</body>\n</html>\n");
  1497.   }
  1498.   /^\/\*\*.*$/ {
  1499.     call (describe_me_html);
  1500.   }
  1501.   /[^\\\/]+/ {
  1502.     /* NOP */
  1503.   }
  1504.   /./ {
  1505.     /* NOP */
  1506.   }
  1507. }
  1508.  
  1509.  
  1510.  
  1511. /*
  1512.  * Language specific states
  1513.  */
  1514.  
  1515. /**
  1516.  * Name: ada
  1517.  * Description: Ada95 programming language.
  1518.  * Author: Rolf Ebert <ebert@waporo.muc.de>
  1519.  */
  1520.  
  1521. state ada
  1522. {
  1523.   BEGIN {
  1524.     header ();
  1525.   }
  1526.   END {
  1527.     trailer ();
  1528.   }
  1529.  
  1530.   /* Comments. */
  1531.   /--/ {
  1532.     comment_face (true);
  1533.     language_print ($0);
  1534.     call (eat_one_line);
  1535.     comment_face (false);
  1536.   }
  1537.  
  1538.   /* String constants. */
  1539.   /\"/ {
  1540.     string_face (true);
  1541.     language_print ($0);
  1542.     call (c_string);
  1543.     string_face (false);
  1544.   }
  1545.  
  1546.  
  1547.   /* Character constants. */
  1548.   /'.'|'\\\\.'/ {
  1549.     string_face (true);
  1550.     language_print ($0);
  1551.     string_face (false);
  1552.   }
  1553.  
  1554.   /* Keywords.
  1555.      (build-re '(abort abs abstract accept access aliased
  1556.      all and array at begin body case constant declare
  1557.      delay delta digits do else elsif end entry
  1558.      exception exit for function generic goto if in
  1559.      is limited loop mod new not null of or others
  1560.      out package pragma private procedure protected raise
  1561.      range record rem renames requeue return reverse
  1562.      select separate subtype tagged task terminate then type
  1563.      until use when while with xor))
  1564.    */
  1565.   /\b(a(b(ort|s(|tract))|cce(pt|ss)|l(iased|l)|nd|rray|t)|b(egin|ody)\
  1566. |c(ase|onstant)|d(e(clare|l(ay|ta))|igits|o)\
  1567. |e(ls(e|if)|n(d|try)|x(ception|it))|f(or|unction)|g(eneric|oto)\
  1568. |i(f|n|s)|l(imited|oop)|mod|n(ew|ot|ull)|o(f|r|thers|ut)\
  1569. |p(ackage|r(agma|ivate|o(cedure|tected)))\
  1570. |r(a(ise|nge)|e(cord|m|names|queue|turn|verse))\
  1571. |s(e(lect|parate)|ubtype)|t(a(gged|sk)|erminate|hen|ype)|u(ntil|se)\
  1572. |w(h(en|ile)|ith)|xor)\b/ {
  1573.     keyword_face (true);
  1574.     language_print ($0);
  1575.     keyword_face (false);
  1576.   }
  1577.  
  1578.   LANGUAGE_SPECIALS {
  1579.     language_print ($0);
  1580.   }
  1581. }
  1582.  
  1583.  
  1584. /**
  1585.  * Name: asm
  1586.  * Description: Assembler listings.
  1587.  * Author: Markku Rossi <mtr@iki.fi>
  1588.  */
  1589.  
  1590. state asm
  1591. {
  1592.   BEGIN {
  1593.     header ();
  1594.   }
  1595.   END {
  1596.     trailer ();
  1597.   }
  1598.  
  1599.   /* Comments. */
  1600.   /;/ {
  1601.     comment_face (true);
  1602.     language_print ($0);
  1603.     call (eat_one_line);
  1604.     comment_face (false);
  1605.   }
  1606.  
  1607.   /* Labels are averything at the beginning of the line, ending to ':' */
  1608.   /^[^\t ]+:/ {
  1609.     function_name_face (true);
  1610.     language_print ($0);
  1611.     function_name_face (true);
  1612.   }
  1613.  
  1614.   /* Asm operands are indented. */
  1615.   /^([ \t]+)([^ \t]+)/ {
  1616.     language_print ($1);
  1617.  
  1618.     keyword_face (true);
  1619.     language_print ($2);
  1620.     keyword_face (false);
  1621.   }
  1622.  
  1623.   /* And finally, highlight string constants. */
  1624.   /\"/ {
  1625.     string_face (true);
  1626.     language_print ($0);
  1627.     call (c_string);
  1628.     string_face (false);
  1629.   }
  1630. }
  1631.  
  1632.  
  1633. /**
  1634.  * Name: awk
  1635.  * Description: AWK programming language.
  1636.  * Author: Juergen Kahrs <Juergen.Kahrs@t-online.de>
  1637.  */
  1638.  
  1639. state awk
  1640. {
  1641.   BEGIN {
  1642.     header ();
  1643.   }
  1644.   END {
  1645.     trailer ();
  1646.   }
  1647.  
  1648.   /* Comments. */
  1649.   /#/ {
  1650.     comment_face (true);
  1651.     language_print ($0);
  1652.     call (eat_one_line);
  1653.     comment_face (false);
  1654.   }
  1655.  
  1656.   /* String constants. */
  1657.   /\"/ {
  1658.     string_face (true);
  1659.     language_print ($0);
  1660.     call (c_string);
  1661.     string_face (false);
  1662.   }
  1663.  
  1664.   /* Excutable script. */
  1665.   /^#!/ {
  1666.     reference_face (true);
  1667.     language_print ($0);
  1668.     call (eat_one_line);
  1669.     reference_face (false);
  1670.   }
  1671.  
  1672.   /* Keywords. */
  1673.   /\b(ARG(C|V|IND)|BEGIN|CONVFMT|E(N(D|VIRON)|RRNO)\
  1674. |F(I(ELDWIDTHS|LENAME)|NR|S)|IGNORECASE|N[FR]|O(FMT|FS|RS)\
  1675. |R(LENGTH|S(TART)?|T)|SUBSEP\
  1676. |atan2|break|c(lose|o(ntinue|s))|d(elete|o)|e(lse|x(it|p))\
  1677. |f(flush|or|unction)|g(((en)?sub)|etline)|i(f|n(dex|t)?)\
  1678. |l(ength|og)|match|next(file)?|return|while|print[f]?\
  1679. |rand|s(in|ub(str)?|ystem|p(lit|rintf)|qrt|rand|trftime|ystime)\
  1680. |to(lower|upper))\b/ {
  1681.     keyword_face (true);
  1682.     language_print ($0);
  1683.     keyword_face (false);
  1684.   }
  1685.  
  1686.   LANGUAGE_SPECIALS {
  1687.     language_print ($0);
  1688.   }
  1689. }
  1690.  
  1691.  
  1692. /**
  1693.  * Name: c
  1694.  * Description: C programming language.
  1695.  * Author: Markku Rossi <mtr@iki.fi>
  1696.  */
  1697.  
  1698. c_keyword_re =
  1699. /* Keywords, but not types, goto, and case.
  1700.    (build-re '(break continue default do else for if return sizeof
  1701.    switch while))
  1702.  */
  1703.   /\b(break|continue|d(efault|o)|else|for|if|return|s(izeof|witch)|while)\b/;
  1704.  
  1705. c_type_re =
  1706. /* Types.
  1707.    (build-re '(auto char const double enum extern float int long
  1708.    register short signed static struct typedef union unsigned void
  1709.    volatile))
  1710.  */
  1711.   /\b(auto|c(har|onst)|double|e(num|xtern)|float|int|long|register\
  1712. |s(hort|igned|t(atic|ruct))|typedef|un(ion|signed)|vo(id|latile))\b/;
  1713.  
  1714. state c_comment
  1715. {
  1716.   /\*\\\// {
  1717.     language_print ($0);
  1718.     return;
  1719.   }
  1720.   LANGUAGE_SPECIALS {
  1721.    language_print ($0);
  1722.   }
  1723. }
  1724.  
  1725. state c_string
  1726. {
  1727.   /\\\\./ {
  1728.     language_print ($0);
  1729.   }
  1730.   /\"/ {
  1731.     language_print ($0);
  1732.     return;
  1733.   }
  1734.   LANGUAGE_SPECIALS {
  1735.     language_print ($0);
  1736.   }
  1737. }
  1738.  
  1739. state c_ppline
  1740. {
  1741.   /* Comments within a pre-processor line. */
  1742.   /\/\*/ {
  1743.     comment_face (true);
  1744.     language_print ($0);
  1745.     call (c_comment);
  1746.     comment_face (false);
  1747.   }
  1748.   /* Include line. */
  1749.   /(include)([ \t]+)/ {
  1750.     reference_face (true);
  1751.     language_print ($1);
  1752.     reference_face (false);
  1753.     language_print ($2);
  1754.     call (c_ppline_include);
  1755.     return;
  1756.   }
  1757.   /* Define line. */
  1758.   /(define)([ \t]+)/ {
  1759.     reference_face (true);
  1760.     language_print ($1);
  1761.     reference_face (false);
  1762.     language_print ($2);
  1763.     call (c_ppline_define);
  1764.     return;
  1765.   }
  1766.   /* Simple directives:
  1767.      (build-re '(undef if ifdef ifndef endif elif else line error pragma))
  1768.    */
  1769.   /\b(e(l(if|se)|ndif|rror)|if(|def|ndef)|line|pragma|undef)\b/ {
  1770.     reference_face (true);
  1771.     language_print ($0);
  1772.     reference_face (false);
  1773.     call (c_ppline_tokensequence);
  1774.     return;
  1775.   }
  1776.   /* An unknown pre-processor directive. */
  1777.   /[a-zA-Z_][^ \t\n]*/ {
  1778.     reference_face (true);
  1779.     language_print ($0);
  1780.     reference_face (false);
  1781.     call (c_ppline_tokensequence);
  1782.     return;
  1783.   }
  1784.   /\n/ {
  1785.     language_print ($0);
  1786.     return;
  1787.   }
  1788.   LANGUAGE_SPECIALS {
  1789.     language_print ($0);
  1790.   }
  1791. }
  1792.  
  1793. state c_ppline_include
  1794. {
  1795.   /\"/ {
  1796.     string_face (true);
  1797.     language_print ($0);
  1798.     call (c_string);
  1799.     string_face (false);
  1800.     call (c_ppline_comments_strings_chars);
  1801.     return;
  1802.   }
  1803.   /<[^<>]+>/ {
  1804.     string_face (true);
  1805.     language_print ($0);
  1806.     string_face (false);
  1807.     call (c_ppline_comments_strings_chars);
  1808.     return;
  1809.   }
  1810.   /[a-zA-Z_][a-zA-Z_0-9]*/ {
  1811.     variable_name_face (true);
  1812.     print ($0);
  1813.     variable_name_face (false);
  1814.     call (c_ppline_comments_strings_chars);
  1815.     return;
  1816.   }
  1817.   /\n/ {
  1818.     language_print ($0);
  1819.     return;
  1820.   }
  1821.   LANGUAGE_SPECIALS {
  1822.     language_print ($0);
  1823.   }
  1824. }
  1825.  
  1826. state c_ppline_define
  1827. {
  1828.   /([a-zA-Z_][a-zA-Z_0-9]*)(\([^\)]*\))?/ {
  1829.     if (strcmp ($2, "") != 0)
  1830.       {
  1831.     function_name_face (true);
  1832.     language_print ($1);
  1833.     function_name_face (false);
  1834.     language_print ($2);
  1835.       }
  1836.     else
  1837.       {
  1838.     variable_name_face (true);
  1839.     language_print ($1);
  1840.     variable_name_face (false);
  1841.       }
  1842.     call (c_ppline_comments_strings_chars);
  1843.     return;
  1844.   }
  1845.   /\n/ {
  1846.     language_print ($0);
  1847.     return;
  1848.   }
  1849.   LANGUAGE_SPECIALS {
  1850.     language_print ($0);
  1851.   }
  1852. }
  1853.  
  1854. state c_ppline_comments_strings_chars
  1855. {
  1856.   /* Comments. */
  1857.   /\/\*/ {
  1858.     comment_face (true);
  1859.     language_print ($0);
  1860.     call (c_comment);
  1861.     comment_face (false);
  1862.   }
  1863.   /* String constants. */
  1864.   /\"/ {
  1865.     string_face (true);
  1866.     language_print ($0);
  1867.     call (c_string);
  1868.     string_face (false);
  1869.   }
  1870.   /* Character constants. */
  1871.   /'.'|'\\\\.'/ {
  1872.     string_face (true);
  1873.     language_print ($0);
  1874.     string_face (false);
  1875.   }
  1876.   /\n/ {
  1877.     language_print ($0);
  1878.     return;
  1879.   }
  1880.   LANGUAGE_SPECIALS {
  1881.     language_print ($0);
  1882.   }
  1883. }
  1884.  
  1885. state c_ppline_tokensequence
  1886. {
  1887.   /* Comments. */
  1888.   /\/\*/ {
  1889.     comment_face (true);
  1890.     language_print ($0);
  1891.     call (c_comment);
  1892.     comment_face (false);
  1893.   }
  1894.   /* String constants. */
  1895.   /\"/ {
  1896.     string_face (true);
  1897.     language_print ($0);
  1898.     call (c_string);
  1899.     string_face (false);
  1900.   }
  1901.   /* Character constants. */
  1902.   /'.'|'\\\\.'/ {
  1903.     string_face (true);
  1904.     language_print ($0);
  1905.     string_face (false);
  1906.   }
  1907.   /* defined() operators. */
  1908.   /(defined)(\()([^\)]+)(\))/ {
  1909.     reference_face (true);
  1910.     language_print ($1);
  1911.     reference_face (false);
  1912.     language_print ($2);
  1913.  
  1914.     variable_name_face (true);
  1915.     language_print ($3);
  1916.     variable_name_face (false);
  1917.  
  1918.     language_print ($4);
  1919.   }
  1920.   /* Variable references. */
  1921.   /\b[a-zA-Z_][a-zA-Z_0-9]*\b/ {
  1922.     variable_name_face (true);
  1923.     language_print ($0);
  1924.     variable_name_face (false);
  1925.   }
  1926.   /\n/ {
  1927.     language_print ($0);
  1928.     return;
  1929.   }
  1930.   LANGUAGE_SPECIALS {
  1931.     language_print ($0);
  1932.   }
  1933. }
  1934.  
  1935. state c
  1936. {
  1937.   BEGIN {
  1938.     if (need_version (1, 5, 1))
  1939.       c_function_name_re
  1940.     = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/;
  1941.     else
  1942.       c_function_name_re = 0;
  1943.  
  1944.     header ();
  1945.   }
  1946.   END {
  1947.     trailer ();
  1948.   }
  1949.  
  1950.   /* Comments. */
  1951.   /\/\*/ {
  1952.     comment_face (true);
  1953.     language_print ($0);
  1954.     call (c_comment);
  1955.     comment_face (false);
  1956.   }
  1957.   /\/\// {
  1958.     comment_face (true);
  1959.     language_print ($0);
  1960.     call (eat_one_line);
  1961.     comment_face (false);
  1962.   }
  1963.  
  1964.   /* String constants. */
  1965.   /\"/ {
  1966.     string_face (true);
  1967.     language_print ($0);
  1968.     call (c_string);
  1969.     string_face (false);
  1970.   }
  1971.  
  1972.   /* Pre-processor lines. */
  1973.   /^#/ {
  1974.     language_print ($0);
  1975.     call (c_ppline);
  1976.   }
  1977.  
  1978.   /* Character constants. */
  1979.   /'.'|'\\\\.'/ {
  1980.     string_face (true);
  1981.     language_print ($0);
  1982.     string_face (false);
  1983.   }
  1984.  
  1985.   /* Keywords. */
  1986.   c_keyword_re {
  1987.     keyword_face (true);
  1988.     language_print ($0);
  1989.     keyword_face (false);
  1990.   }
  1991.  
  1992.   /* Types. */
  1993.   c_type_re {
  1994.     type_face (true);
  1995.     language_print ($0);
  1996.     type_face (false);
  1997.   }
  1998.  
  1999.   /* Labels and case tags.  Emacs accepts also bare numbers. */
  2000.   /([a-zA-Z0-9_]+)(:)/ {
  2001.     if (strcmp ($1, "default") == 0)
  2002.       {
  2003.     /* `default' is a keyword. */
  2004.     keyword_face (true);
  2005.     language_print ($1);
  2006.     keyword_face (false);
  2007.       }
  2008.     else
  2009.       {
  2010.     reference_face (true);
  2011.     language_print ($1);
  2012.     reference_face (false);
  2013.       }
  2014.  
  2015.     language_print ($2);
  2016.   }
  2017.  
  2018.   /* Goto, case and the target. */
  2019.   /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ {
  2020.     keyword_face (true);
  2021.     language_print ($1);
  2022.     keyword_face (false);
  2023.  
  2024.     language_print ($2);
  2025.  
  2026.     if (length ($3) > 0)
  2027.       {
  2028.     reference_face (true);
  2029.     language_print ($3);
  2030.     reference_face (false);
  2031.       }
  2032.   }
  2033.  
  2034.   /*
  2035.    * Function definitions, but only if you code with the one and only
  2036.    * usable indentation style (GNU).
  2037.    */
  2038.   /^([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/ {
  2039.     function_name_face (true);
  2040.     language_print ($1);
  2041.     function_name_face (false);
  2042.  
  2043.     language_print ($2);
  2044.   }
  2045.  
  2046.   /* Function definitions and prototypes for other (loser) coding styles. */
  2047.   c_function_name_re {
  2048.     garbage = $1;
  2049.     middle_garbage = $2;
  2050.     function_name = $3;
  2051.     tail_garbage = $4;
  2052.  
  2053.     highlight_types (garbage, c_type_re);
  2054.  
  2055.     language_print (middle_garbage);
  2056.  
  2057.     function_name_face (true);
  2058.     language_print (function_name);
  2059.     function_name_face (false);
  2060.  
  2061.     language_print (tail_garbage);
  2062.   }
  2063.  
  2064.   LANGUAGE_SPECIALS {
  2065.     language_print ($0);
  2066.   }
  2067. }
  2068.  
  2069.  
  2070. /**
  2071.  * Name: changelog
  2072.  * Description: ChangeLog files.
  2073.  * Author: Markku Rossi <mtr@iki.fi>
  2074.  */
  2075.  
  2076. state changelog
  2077. {
  2078.   BEGIN {
  2079.     header ();
  2080.   }
  2081.   END {
  2082.     trailer ();
  2083.   }
  2084.  
  2085.   /* Date entries.  Both new and old formats. */
  2086.   /^([^ \t]........[0-9: ]*)([^<]+)(<)([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+)(>)/ {
  2087.     string_face (true);
  2088.     language_print ($1);
  2089.     string_face (false);
  2090.  
  2091.     reference_face (true);
  2092.     language_print ($2);
  2093.     reference_face (false);
  2094.  
  2095.     language_print ($3);
  2096.  
  2097.     variable_name_face (true);
  2098.     language_print ($4);
  2099.     variable_name_face (false);
  2100.  
  2101.     language_print ($5);
  2102.   }
  2103.  
  2104.   /* File descriptions with function names. */
  2105.   /(^\t\* )([^\(]+)(\()([^\)]+)(\):)/ {
  2106.     language_print ($1);
  2107.  
  2108.     function_name_face (true);
  2109.     language_print ($2);
  2110.     function_name_face (false);
  2111.  
  2112.     language_print ($3);
  2113.  
  2114.     keyword_face (true);
  2115.     language_print ($4);
  2116.     keyword_face (false);
  2117.  
  2118.     language_print ($5);
  2119.   }
  2120.  
  2121.   /* File descriptions without function names. */
  2122.   /(^\t\* )([^ :]+)(:)/ {
  2123.     language_print ($1);
  2124.  
  2125.     function_name_face (true);
  2126.     language_print ($2);
  2127.     function_name_face (false);
  2128.  
  2129.     language_print ($3);
  2130.   }
  2131.  
  2132.   /* Function name descriptions without file names. */
  2133.   /(^\t\()([^\)]+)(\):)/ {
  2134.     language_print ($1);
  2135.  
  2136.     keyword_face (true);
  2137.     language_print ($2);
  2138.     keyword_face (false);
  2139.  
  2140.     language_print ($3);
  2141.   }
  2142.  
  2143.   LANGUAGE_SPECIALS {
  2144.     language_print ($0);
  2145.   }
  2146. }
  2147.  
  2148.  
  2149. /**
  2150.  * Name: cpp
  2151.  * Description: C++ programming language.
  2152.  * Author: Markku Rossi <mtr@iki.fi>
  2153.  */
  2154.  
  2155. cpp_keyword_re =
  2156. /* Keywords, but not types, goto, and case.
  2157.    (build-re '(asm break catch continue default delete do else for if
  2158.    new operator overload return sizeof switch this throw try while))
  2159.   */
  2160.   /\b(asm|break|c(atch|ontinue)|d(e(fault|lete)|o)|else|for|if|new\
  2161. |o(perator|verload)|return|s(izeof|witch)|t(h(is|row)|ry)|while)\b/;
  2162.  
  2163. cpp_type_re =
  2164. /* Types.
  2165.    (build-re '(auto bool char class complex const double enum extern
  2166.    float friend inline int long private protected public register
  2167.    short signed static struct template typedef union unsigned virtual
  2168.    void volatile))
  2169.   */
  2170.   /\b(auto|bool|c(har|lass|o(mplex|nst))|double|e(num|xtern)|f(loat|riend)\
  2171. |in(line|t)|long|p(r(ivate|otected)|ublic)|register\
  2172. |s(hort|igned|t(atic|ruct))|t(emplate|ypedef)|un(ion|signed)\
  2173. |v(irtual|o(id|latile)))\b/;
  2174.  
  2175. state cpp
  2176. {
  2177.   BEGIN {
  2178.     if (need_version (1, 5, 1))
  2179.       cpp_function_name_re
  2180.     = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/;
  2181.     else
  2182.       cpp_function_name_re = 0;
  2183.  
  2184.     header ();
  2185.   }
  2186.   END {
  2187.     trailer ();
  2188.   }
  2189.  
  2190.   /* Comments. */
  2191.   /\/\*/ {
  2192.     comment_face (true);
  2193.     language_print ($0);
  2194.     call (c_comment);
  2195.     comment_face (false);
  2196.   }
  2197.   /\/\// {
  2198.     comment_face (true);
  2199.     language_print ($0);
  2200.     call (eat_one_line);
  2201.     comment_face (false);
  2202.   }
  2203.  
  2204.   /* String constants. */
  2205.   /\"/ {
  2206.     string_face (true);
  2207.     language_print ($0);
  2208.     call (c_string);
  2209.     string_face (false);
  2210.   }
  2211.  
  2212.   /* Pre-processor lines. */
  2213.   /^#/ {
  2214.     language_print ($0);
  2215.     call (c_ppline);
  2216.   }
  2217.  
  2218.   /* Character constants. */
  2219.   /'.'|'\\\\.'/ {
  2220.     string_face (true);
  2221.     language_print ($0);
  2222.     string_face (false);
  2223.   }
  2224.  
  2225.   /* Keywords. */
  2226.   cpp_keyword_re {
  2227.     keyword_face (true);
  2228.     language_print ($0);
  2229.     keyword_face (false);
  2230.   }
  2231.  
  2232.   /* Types. */
  2233.   cpp_type_re {
  2234.     type_face (true);
  2235.     language_print ($0);
  2236.     type_face (false);
  2237.   }
  2238.  
  2239.   /* Remove false labels. */
  2240.   /[a-zA-Z0-9_]+::/ {
  2241.     language_print ($0);
  2242.   }
  2243.  
  2244.   /* Labels and case tags.  Emacs accepts also bare numbers. */
  2245.   /([a-zA-Z0-9_]+)(:)/ {
  2246.     if (strcmp ($1, "default") == 0)
  2247.       {
  2248.     /* `default' is a keyword. */
  2249.     keyword_face (true);
  2250.     language_print ($1);
  2251.     keyword_face (false);
  2252.       }
  2253.     else if (strcmp ($1, "public") == 0
  2254.          || strcmp ($1, "private") == 0
  2255.          || strcmp ($1, "protected") == 0)
  2256.       {
  2257.     /* These use the `type' face. */
  2258.     type_face (true);
  2259.     language_print ($1);
  2260.     type_face (false);
  2261.       }
  2262.     else
  2263.       {
  2264.     reference_face (true);
  2265.     language_print ($1);
  2266.     reference_face (false);
  2267.       }
  2268.  
  2269.     language_print ($2);
  2270.   }
  2271.  
  2272.   /* Goto and its target. */
  2273.   /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ {
  2274.     keyword_face (true);
  2275.     language_print ($1);
  2276.     keyword_face (false);
  2277.  
  2278.     language_print ($2);
  2279.  
  2280.     if (length ($3) > 0)
  2281.       {
  2282.     reference_face (true);
  2283.     language_print ($3);
  2284.     reference_face (false);
  2285.       }
  2286.   }
  2287.  
  2288.   /*
  2289.    * Function definitions, but only if you code with the one and only
  2290.    * usable indentation style (GNU).
  2291.    */
  2292.   /^([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ {
  2293.     function_name_face (true);
  2294.     language_print ($1);
  2295.     function_name_face (false);
  2296.  
  2297.     language_print ($2);
  2298.   }
  2299.  
  2300.   /* Function definitions and prototypes for other (loser) coding styles. */
  2301.   cpp_function_name_re {
  2302.     garbage = $1;
  2303.     middle_garbage = $2;
  2304.     function_name = $3;
  2305.     tail_garbage = $4;
  2306.  
  2307.     highlight_types (garbage, cpp_type_re);
  2308.  
  2309.     language_print (middle_garbage);
  2310.  
  2311.     function_name_face (true);
  2312.     language_print (function_name);
  2313.     function_name_face (false);
  2314.  
  2315.     language_print (tail_garbage);
  2316.   }
  2317.  
  2318.   LANGUAGE_SPECIALS {
  2319.     language_print ($0);
  2320.   }
  2321. }
  2322.  
  2323.  
  2324. /**
  2325.  * Name: diff
  2326.  * Description: normal diffs
  2327.  * Author: buchal@ifh.bau-verm.uni-karlsruhe.de
  2328.  */
  2329.  
  2330. state diff
  2331. {
  2332.   BEGIN {
  2333.     header ();
  2334.   }
  2335.   END {
  2336.     trailer ();
  2337.   }
  2338.  
  2339.   /^[0-9]/ {
  2340.     comment_face (true);
  2341.     language_print ($0);
  2342.     call (eat_one_line);
  2343.     comment_face (false);
  2344.   }
  2345.  
  2346.   /^</ {
  2347.     function_name_face (true);
  2348.     language_print ($0);
  2349.     call (eat_one_line);
  2350.     function_name_face (false);
  2351.   }
  2352.  
  2353.   /^>/ {
  2354.     reference_face (true);
  2355.     language_print ($0);
  2356.     call (eat_one_line);
  2357.     reference_face (false);
  2358.   }
  2359.   /^[^\ ]/ {
  2360.     string_face (true);
  2361.     language_print ($0);
  2362.     call (eat_one_line);
  2363.     string_face (false);
  2364.   }
  2365. }
  2366.  
  2367.  
  2368. /**
  2369.  * Name: diffu
  2370.  * Description: unified diffs
  2371.  * Author: buchal@ifh.bau-verm.uni-karlsruhe.de
  2372.  */
  2373.  
  2374. state diffu
  2375. {
  2376.   BEGIN {
  2377.     header ();
  2378.   }
  2379.   END {
  2380.     trailer ();
  2381.   }
  2382.  
  2383.   /^\@\@/ {
  2384.     comment_face (true);
  2385.     language_print ($0);
  2386.     call (eat_one_line);
  2387.     comment_face (false);
  2388.   }
  2389.  
  2390.   /^-/ {
  2391.     function_name_face (true);
  2392.     language_print ($0);
  2393.     call (eat_one_line);
  2394.     function_name_face (false);
  2395.   }
  2396.  
  2397.   /^+/ {
  2398.     reference_face (true);
  2399.     language_print ($0);
  2400.     call (eat_one_line);
  2401.     reference_face (false);
  2402.   }
  2403.   /^[^\ ]/ {
  2404.     string_face (true);
  2405.     language_print ($0);
  2406.     call (eat_one_line);
  2407.     string_face (false);
  2408.   }
  2409. }
  2410.  
  2411.  
  2412. /**
  2413.  * Name: delphi
  2414.  * Description: Delphi programming language.
  2415.  * Author: Michael Van Canneyt <michael@tfdec1.fys.kuleuven.ac.be>
  2416.  */
  2417.  
  2418. state delphi
  2419. {
  2420.   BEGIN {
  2421.     header ();
  2422.   }
  2423.   END {
  2424.     trailer ();
  2425.   }
  2426.   /* comments */
  2427.   /(\{|\(\*)/ {
  2428.     comment_face (true);
  2429.     language_print ($0);
  2430.     call (pascal_comment);
  2431.     comment_face (false);
  2432.   }
  2433.   /* C++ -style comments */
  2434.   /\/\// {
  2435.     comment_face (true);
  2436.     language_print ($0);
  2437.     call (eat_one_line);
  2438.     comment_face (false);
  2439.   }
  2440.   /* strings */
  2441.   /[\']/ {
  2442.     string_face (true);
  2443.     language_print ($0);
  2444.     call (pascal_string);
  2445.     string_face (false);
  2446.   }
  2447.   /* Keywords.
  2448.      (build-re '(and asm array begin case const constructor destructor
  2449.      div do downto else end file for function goto if implementation
  2450.      in inline interface label mod nil not object of or packed
  2451.      procedure program record repeat set shlr string then to type
  2452.      unit until uses var while with xor As class except exports
  2453.      finalization finally inherited initialization is library property
  2454.      raise threAdvar try absolute abstract assembler automated cdecl
  2455.      default dispid dynamic export external far forward index message
  2456.      name near nodefault override pascal private protected public
  2457.      published read register resident stdcall stored virtual write)
  2458.      t)
  2459.    */
  2460.   /\b(A[sS]\
  2461. |[aA]([bB][sS]([oO][lL][uU][tT][eE]|[tT][rR][aA][cC][tT])|[nN][dD]\
  2462. |[rR][rR][aA][yY]|[sS]([mM]|[sS][eE][mM][bB][lL][eE][rR])\
  2463. |[uU][tT][oO][mM][aA][tT][eE][dD])\
  2464. |[bB][eE][gG][iI][nN]\
  2465. |[cC]([aA][sS][eE]|[dD][eE][cC][lL]|[lL][aA][sS][sS]\
  2466. |[oO][nN][sS][tT](|[rR][uU][cC][tT][oO][rR]))\
  2467. |[dD]([eE]([fF][aA][uU][lL][tT]|[sS][tT][rR][uU][cC][tT][oO][rR])\
  2468. |[iI]([sS][pP][iI][dD]|[vV])|[oO](|[wW][nN][tT][oO])\
  2469. |[yY][nN][aA][mM][iI][cC])\
  2470. |[eE]([lL][sS][eE]|[nN][dD]\
  2471. |[xX]([cC][eE][pP][tT]|[pP][oO][rR][tT](|[sS])|[tT][eE][rR][nN][aA][lL]))\
  2472. |[fF]([aA][rR]\
  2473. |[iI]([lL][eE]|[nN][aA][lL]([iI][zZ][aA][tT][iI][oO][nN]|[lL][yY]))\
  2474. |[oO][rR](|[wW][aA][rR][dD])|[uU][nN][cC][tT][iI][oO][nN])\
  2475. |[gG][oO][tT][oO]\
  2476. |[iI]([fF]|[mM][pP][lL][eE][mM][eE][nN][tT][aA][tT][iI][oO][nN]\
  2477. |[nN](|[dD][eE][xX]|[hH][eE][rR][iI][tT][eE][dD]\
  2478. |[iI][tT][iI][aA][lL][iI][zZ][aA][tT][iI][oO][nN]|[lL][iI][nN][eE]\
  2479. |[tT][eE][rR][fF][aA][cC][eE])\
  2480. |[sS])\
  2481. |[lL]([aA][bB][eE][lL]|[iI][bB][rR][aA][rR][yY])\
  2482. |[mM]([eE][sS][sS][aA][gG][eE]|[oO][dD])\
  2483. |[nN]([aA][mM][eE]|[eE][aA][rR]|[iI][lL]\
  2484. |[oO]([dD][eE][fF][aA][uU][lL][tT]|[tT]))\
  2485. |[oO]([bB][jJ][eE][cC][tT]|[fF]|[rR]|[vV][eE][rR][rR][iI][dD][eE])\
  2486. |[pP]([aA]([cC][kK][eE][dD]|[sS][cC][aA][lL])\
  2487. |[rR]([iI][vV][aA][tT][eE]\
  2488. |[oO]([cC][eE][dD][uU][rR][eE]|[gG][rR][aA][mM]|[pP][eE][rR][tT][yY]\
  2489. |[tT][eE][cC][tT][eE][dD]))\
  2490. |[uU][bB][lL][iI]([cC]|[sS][hH][eE][dD]))\
  2491. |[rR]([aA][iI][sS][eE]\
  2492. |[eE]([aA][dD]|[cC][oO][rR][dD]|[gG][iI][sS][tT][eE][rR]|[pP][eE][aA][tT]\
  2493. |[sS][iI][dD][eE][nN][tT]))\
  2494. |[sS]([eE][tT]|[hH][lL][rR]\
  2495. |[tT]([dD][cC][aA][lL][lL]|[oO][rR][eE][dD]|[rR][iI][nN][gG]))\
  2496. |[tT]([hH]([eE][nN]|[rR][eE]A[dD][vV][aA][rR])|[oO]|[rR][yY]|[yY][pP][eE])\
  2497. |[uU]([nN]([iI][tT]|[tT][iI][lL])|[sS][eE][sS])\
  2498. |[vV]([aA][rR]|[iI][rR][tT][uU][aA][lL])\
  2499. |[wW]([hH][iI][lL][eE]|[iI][tT][hH]|[rR][iI][tT][eE])|[xX][oO][rR])\b/ {
  2500.     keyword_face (true);
  2501.     language_print ($0);
  2502.     keyword_face (false);
  2503.   }
  2504. }
  2505.  
  2506.  
  2507. /**
  2508.  * Name: elisp
  2509.  * Description: Emacs LISP.
  2510.  */
  2511.  
  2512. state elisp
  2513. {
  2514.   BEGIN {
  2515.     header ();
  2516.   }
  2517.   END {
  2518.     trailer ();
  2519.   }
  2520.  
  2521.   /* Comments. */
  2522.   /;/ {
  2523.     comment_face (true);
  2524.     language_print ($0);
  2525.     call (eat_one_line);
  2526.     comment_face (false);
  2527.   }
  2528.  
  2529.   /* String constants. */
  2530.   /\"/ {
  2531.     string_face (true);
  2532.     language_print ($0);
  2533.     call (c_string);
  2534.     string_face (false);
  2535.   }
  2536.  
  2537.   /* Definitions. */
  2538.   /(\([ \t]*)(defun)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
  2539.     /* Starting garbage. */
  2540.     language_print ($1);
  2541.  
  2542.     /* Keyword `defun'. */
  2543.     keyword_face (true);
  2544.     language_print ($2);
  2545.     keyword_face (false);
  2546.  
  2547.     /* Middle garbage. */
  2548.     language_print ($3);
  2549.  
  2550.     /* Function name. */
  2551.     function_name_face (true);
  2552.     language_print ($4);
  2553.     function_name_face (false);
  2554.   }
  2555.  
  2556.   /* ':'-names, Emacs highlights these, so do we. */
  2557.   /([ \t])(:[!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
  2558.     language_print ($1);
  2559.     reference_face (true);
  2560.     language_print ($2);
  2561.     reference_face (false);
  2562.   }
  2563.  
  2564.   /* Keywords taken out of fond-lock.el.  Added: and, or, lambda.
  2565.      (build-re '(and or lambda cond if while let let* prog progn
  2566.      progv prog1 prog2 prog* inline catch throw save-restriction
  2567.      save-excursion save-window-excursion save-selected-window
  2568.      save-match-data unwind-protect condition-case track-mouse
  2569.      eval-after-load eval-and-compile eval-when-compile when
  2570.      unless do flet labels return return-from with-output-to-temp-buffer
  2571.      with-timeout))
  2572.    */
  2573.   /\b(and|c(atch|ond(|ition-case))|do\
  2574. |eval-(a(fter-load|nd-compile)|when-compile)|flet|i(f|nline)\
  2575. |l(a(bels|mbda)|et(|*))|or|prog(|*|1|2|n|v)|return(|-from)\
  2576. |save-(excursion|match-data|restriction|selected-window|window-excursion)\
  2577. |t(hrow|rack-mouse)|un(less|wind-protect)\
  2578. |w(h(en|ile)|ith-(output-to-temp-buffer|timeout)))\b/ {
  2579.     keyword_face (true);
  2580.     language_print ($0);
  2581.     keyword_face (false);
  2582.   }
  2583.  
  2584.   LANGUAGE_SPECIALS {
  2585.     language_print ($0);
  2586.   }
  2587. }
  2588.  
  2589.  
  2590. /**
  2591.  * Name: fortran
  2592.  * Description: Fortran77 programming language.
  2593.  * Author: Keith Refson <Keith.Refson@earth.ox.ac.uk>
  2594.  *       Markku Rossi <mtr@iki.fi>
  2595.  */
  2596.  
  2597. state fortran_string
  2598. {
  2599.   /[\']/ {
  2600.     language_print ($0);
  2601.     return;
  2602.   }
  2603.   LANGUAGE_SPECIALS {
  2604.     language_print ($0);
  2605.   }
  2606. }
  2607.  
  2608. state fortran_io
  2609. {
  2610.    /\)/ {
  2611.      language_print ($0);
  2612.      return;
  2613.    }
  2614.  
  2615.   /* IO Keywords.  (build-re '(FMT UNIT REC END ERR FILE STATUS
  2616.      ACCESS FORM RECL BLANK IOSTAT EXIST OPENED NUMBER NAME
  2617.      SEQUENTIAL DIRECT FORMATTED UNFORMATTED NEXTREC)) */
  2618.   /\BbACCESS|BLANK|DIRECT|E(ND|RR|XIST)|F(ILE|MT|ORM(|ATTED))|IOSTAT\
  2619. |N(AME|EXTREC|UMBER)|OPENED|REC(|L)|S(EQUENTIAL|TATUS)\
  2620. |UN(FORMATTED|IT))\b/ {
  2621.  
  2622.       keyword_face (true);
  2623.       language_print ($0);
  2624.       keyword_face (false);
  2625.    }
  2626.  
  2627.   /* IO Keywords.  (build-re '(fmt unit rec end err file status
  2628.      access form recl blank iostat exist opened number name
  2629.      sequential direct formatted unformatted nextrec)) */
  2630.   /\b(access|blank|direct|e(nd|rr|xist)|f(ile|mt|orm(|atted))|iostat\
  2631. |n(ame|extrec|umber)|opened|rec(|l)|s(equential|tatus)\
  2632. |un(formatted|it))\b/ {
  2633.  
  2634.       keyword_face (true);
  2635.       language_print ($0);
  2636.       keyword_face (false);
  2637.    }
  2638.    LANGUAGE_SPECIALS {
  2639.       language_print ($0);
  2640.    }
  2641. }
  2642.  
  2643. state fortran
  2644. {
  2645.   BEGIN {
  2646.     header ();
  2647.   }
  2648.   END {
  2649.     trailer ();
  2650.   }
  2651.  
  2652.   /* Comments. */
  2653.   /^[cC!\*]/ {
  2654.     comment_face (true);
  2655.     language_print ($0);
  2656.     call (eat_one_line);
  2657.     comment_face (false);
  2658.   }
  2659.  
  2660.   /* String constants. */
  2661.   /[\']/ {
  2662.     string_face (true);
  2663.     language_print ($0);
  2664.     call (fortran_string);
  2665.     string_face (false);
  2666.   }
  2667.  
  2668.   /* Comparators.  We have to roll by hand because of the
  2669.      dots - "\b" doesn't delimit here. */
  2670.   /\.(and|eqv?|g(e|t)|l(e|t)|ne(qv)?|not|or)\./ {
  2671.     keyword_face (true);
  2672.     language_print ($0);
  2673.     keyword_face (false);
  2674.   }
  2675.  
  2676.   /* Comparators.  We have to roll by hand because of the
  2677.      dots - "\b" doesn't delimit here. */
  2678.   /\.(AND|EQV?|G(E|T)|L(E|T)|NE(QV)?|NOT|OR)\./ {
  2679.     keyword_face (true);
  2680.     language_print ($0);
  2681.     keyword_face (false);
  2682.   }
  2683.  
  2684.   /* IO Statement (build-re '(open close read
  2685.   write inquire backspace endfile rewind )) */
  2686.   /\b(backspace|close|endfile|inquire|open|re(ad|wind)|write)\b/ {
  2687.  
  2688.     keyword_face (true);
  2689.     language_print ($0);
  2690.     keyword_face (false);
  2691.     call (fortran_io);
  2692.   }
  2693.  
  2694.   /* IO Statement (build-re '(OPEN CLOSE READ
  2695.   WRITE INQUIRE BACKSPACE ENDFILE REWIND )) */
  2696.   /\b(BACKSPACE|CLOSE|ENDFILE|INQUIRE|OPEN|RE(AD|WIND)|WRITE)\b/ {
  2697.  
  2698.     keyword_face (true);
  2699.     language_print ($0);
  2700.     keyword_face (false);
  2701.     call (fortran_io);
  2702.   }
  2703.  
  2704.   /* Keywords.  (build-re '( block\ *data call
  2705.      character\\*\[0-9\]+ common complex\\*\[0-9\]+ continue
  2706.      data dimension do double\ *precision else elseif end enddo
  2707.      endfile endif entry equivalence external format function
  2708.      go\ *to if implicit include integer\\*\[0-9\]+ intrinsic
  2709.      logical\\*\[0-9\]+ parameter pause print program
  2710.      real\\*\[0-9\]+ return  save stop subroutine then while )) */
  2711.   /\b(block *data|c(all|haracter\*[0-9]+|o(m(mon|plex\*[0-9]+)|ntinue))\
  2712. |d(ata|imension|o(|uble *precision))\
  2713. |e(lse(|if)|n(d(|do|file|if)|try)|quivalence|xternal)|f(ormat|unction)\
  2714. |go *to|i(f|mplicit|n(clude|t(eger\*[0-9]+|rinsic)))|logical\*[0-9]+\
  2715. |p(a(rameter|use)|r(int|ogram))|re(al\*[0-9]+|turn)\
  2716. |s(ave|top|ubroutine)|then|while)\b/ {
  2717.  
  2718.     keyword_face (true);
  2719.     language_print ($0);
  2720.     keyword_face (false);
  2721.   }
  2722.   /* Keywords.  (build-re '( block\ *data call
  2723.      character\\*\[0-9\]+ COMMON COMPLEX\\*\[0-9\]+ CONTINUE
  2724.      DATA DIMENSION DO DOUBLE\ *PRECISION ELSE ELSEIF END ENDDO
  2725.      ENDFILE ENDIF ENTRY EQUIVALENCE EXTERNAL FORMAT FUNCTION
  2726.      GO\ *TO IF IMPLICIT INCLUDE INTEGER\\*\[0-9\]+ INTRINSIC
  2727.      LOGICAL\\*\[0-9\]+ PARAMETER PAUSE PRINT PROGRAM
  2728.      REAL\\*\[0-9\]+ RETURN  SAVE STOP SUBROUTINE THEN WHILE )) */
  2729.   /\b(BLOCK *DATA|C(ALL|HARACTER\*[0-9]+|O(M(MON|PLEX\*[0-9]+)|NTINUE))\
  2730. |D(ATA|IMENSION|O(|UBLE *PRECISION))\
  2731. |E(LSE(|IF)|N(D(|DO|FILE|IF)|TRY)|QUIVALENCE|XTERNAL)|F(ORMAT|UNCTION)\
  2732. |GO *TO|I(F|MPLICIT|N(CLUDE|T(EGER\*[0-9]+|RINSIC)))|LOGICAL\*[0-9]+\
  2733. |P(A(RAMETER|USE)|R(INT|OGRAM))|RE(AL\*[0-9]+|TURN)\
  2734. |S(AVE|TOP|UBROUTINE)|THEN|WHILE)\b/ {
  2735.  
  2736.     keyword_face (true);
  2737.     language_print ($0);
  2738.     keyword_face (false);
  2739.   }
  2740.   LANGUAGE_SPECIALS {
  2741.     language_print ($0);
  2742.   }
  2743. }
  2744.  
  2745.  
  2746. /**
  2747.  * Name: haskell
  2748.  * Description: Haskell programming language.
  2749.  *
  2750.  * Simple highlighting treating keywords, comments, strings and type
  2751.  * expressions specially.
  2752.  *
  2753.  * Author: Hans-Wolfgang Loidl <hwloidl@dcs.gla.ac.uk>
  2754.  * Date: 27/2/97
  2755.  */
  2756.  
  2757. state haskell
  2758. {
  2759.   BEGIN {
  2760.     header ();
  2761.   }
  2762.   END {
  2763.     trailer ();
  2764.   }
  2765.  
  2766.   /* Comments. */
  2767.   /\{\-/ {
  2768.     comment_face (true);
  2769.     language_print ($0);
  2770.     call (haskell_comment);
  2771.     comment_face (false);
  2772.   }
  2773.  
  2774.   /* One line comments. */
  2775.   /\-\-/ {
  2776.     comment_face (true);
  2777.     language_print ($0);
  2778.     call (eat_one_line);
  2779.     comment_face (false);
  2780.   }
  2781.  
  2782.   /* Built-in beasts (GHC specific). */
  2783.   /\b\_/ {
  2784.     keyword_face (true);
  2785.     language_print ($0);
  2786.     call (haskell_builtin);
  2787.     keyword_face (false);
  2788.   }
  2789.  
  2790.   /* Type declarations. */
  2791.   /::/ {
  2792.     type_face (true);
  2793.     language_print ($0);
  2794.     call (eat_one_line);
  2795.     /* call (haskell_type); */
  2796.     type_face (false);
  2797.   }
  2798.  
  2799.   /* String constants. */
  2800.   /\"/ {
  2801.     string_face (true);
  2802.     language_print ($0);
  2803.     call (haskell_string);
  2804.     string_face (false);
  2805.   }
  2806.  
  2807.   /* Pre-processor lines. */
  2808.   /^#/ {
  2809.     reference_face (true);
  2810.     language_print ($0);
  2811.     call (eat_one_line);
  2812.     /* call (haskell_ppline); */
  2813.     reference_face (false);
  2814.   }
  2815.  
  2816.   /* Character constants. */
  2817.   /'.'|'\\.'/ {
  2818.     string_face (true);
  2819.     language_print ($0);
  2820.     string_face (false);
  2821.   }
  2822.  
  2823.   /* Keywords.
  2824.      I took that from haskell.el. The True Way to do it would be to grab it
  2825.      out of the on-line haskell report (actually, The Real True Way would
  2826.      be to write a Haskell program that extracts different kinds of
  2827.      keywords and to partially evaluate it wrt the Haskell report; but that
  2828.      might be a wee overkill).
  2829.      (let ((strings
  2830.     '("case" "class" "data" "default" "deriving" "else" "hiding" "if" "import" "in" "\
  2831.       infix" "infixl" "infixr" "instance" "interface" "let" "module" "of" "renaming" "\
  2832.       then" "to" "type" "where" )))
  2833.       (make-regexp strings)
  2834.      )
  2835.      ==>
  2836.      \(infix\|then\)\|c\(ase\|lass\)\|d\(ata\|e\(fault\|riving\)\)\|else\|hiding\|i\([fn]\|mport\|n\(fix[lr]\|stance\|terface\)\)\|let\|module\|of\|renaming\|t\(o\|ype\)\|where
  2837.    */
  2838.   /\b((infix|then)|c(ase|lass)|d(ata|e(fault|riving))|else|hiding|i([fn]|mport|n(fix[lr]|stance|terface))|let|module|of|renaming|t(o|ype)|where)\b/ {
  2839.     keyword_face (true);
  2840.     language_print ($0);
  2841.     keyword_face (false);
  2842.   }
  2843.  
  2844.   LANGUAGE_SPECIALS {
  2845.     language_print ($0);
  2846.   }
  2847. }
  2848.  
  2849. state haskell_comment
  2850. {
  2851.   /\-\}/ {
  2852.     language_print ($0);
  2853.     return;
  2854.   }
  2855.   LANGUAGE_SPECIALS {
  2856.    language_print ($0);
  2857.   }
  2858. }
  2859.  
  2860. /*
  2861. state haskell_one_line_comment
  2862. {
  2863.   /\n/ {
  2864.     language_print ($0);
  2865.     return;
  2866.   }
  2867.   LANGUAGE_SPECIALS {
  2868.    language_print ($0);
  2869.   }
  2870. }
  2871. */
  2872.  
  2873. /* HWL: for GHC builtin objects like _parGlobal_ i.e. not std Haskell */
  2874. state haskell_builtin
  2875. {
  2876.   /(\_\b)| / {
  2877.     language_print ($0);
  2878.     return;
  2879.   }
  2880.   LANGUAGE_SPECIALS {
  2881.    language_print ($0);
  2882.   }
  2883. }
  2884.  
  2885. state haskell_type
  2886. {
  2887.   /* ToDo: Implement type continuation lines:
  2888.        If the line ends in a -> or the next starts with a -> then we
  2889.        are still in a type expression
  2890.   */
  2891.   /\n/ {
  2892.     language_print ($0);
  2893.     return;
  2894.   }
  2895.   LANGUAGE_SPECIALS {
  2896.    language_print ($0);
  2897.   }
  2898. }
  2899.  
  2900. state haskell_string
  2901. {
  2902.   /\\\\./ {
  2903.     language_print ($0);
  2904.   }
  2905.   /\"/ {
  2906.     language_print ($0);
  2907.     return;
  2908.   }
  2909.   LANGUAGE_SPECIALS {
  2910.     language_print ($0);
  2911.   }
  2912. }
  2913.  
  2914. state haskell_ppline
  2915. {
  2916.   /\/\*/ {
  2917.     /* Comment within a pre-processor line. */
  2918.     reference_face (false);
  2919.     comment_face (true);
  2920.     language_print ($0);
  2921.     call (c_comment);
  2922.     comment_face (false);
  2923.     reference_face (true);
  2924.   }
  2925.   /\n/ {
  2926.     language_print ($0);
  2927.     return;
  2928.   }
  2929.   LANGUAGE_SPECIALS {
  2930.     language_print ($0);
  2931.   }
  2932. }
  2933.  
  2934.  
  2935. /**
  2936.  * Name: html
  2937.  * Description: Hypertext markup language HTML.
  2938.  * Author: Markku Rossi <mtr@iki.fi>
  2939.  */
  2940.  
  2941. state html_tag
  2942. {
  2943.   />/ {
  2944.     language_print ($0);
  2945.     return;
  2946.   }
  2947.   /\"/ {
  2948.     keyword_face (false);
  2949.     string_face (true);
  2950.     language_print ($0);
  2951.     call (c_string);
  2952.     string_face (false);
  2953.     keyword_face (true);
  2954.   }
  2955.   LANGUAGE_SPECIALS {
  2956.     language_print ($0);
  2957.   }
  2958. }
  2959.  
  2960. state html_entity
  2961. {
  2962.   /;/ {
  2963.     language_print ($0);
  2964.     return;
  2965.   }
  2966.   LANGUAGE_SPECIALS {
  2967.     language_print ($0);
  2968.   }
  2969. }
  2970.  
  2971. state html_script_tag {
  2972.   /\"/ {
  2973.     keyword_face (false);
  2974.     string_face (true);
  2975.     language_print ($0);
  2976.     call (c_string);
  2977.     string_face (false);
  2978.     keyword_face (true);
  2979.   }
  2980.   /([lL][aA][nN][gG][uU][aA][gG][eE]=\")([^\"]*)(\")/ {
  2981.     html_script_language = $2;
  2982.  
  2983.     language_print ($1);
  2984.     keyword_face (false);
  2985.  
  2986.     string_face (true);
  2987.     language_print ($2);
  2988.     string_face (false);
  2989.  
  2990.     keyword_face (true);
  2991.     language_print ($3);
  2992.   }
  2993.   />/ {
  2994.     language_print ($0);
  2995.     return;
  2996.   }
  2997.   LANGUAGE_SPECIALS {
  2998.     language_print ($0);
  2999.   }
  3000. }
  3001.  
  3002. state html_skip_script
  3003. {
  3004.   /* Terminator for nested scripts. */
  3005.   /<\/[sS][cC][rR][iI][pP][tT]>/ {
  3006.     from_html_terminator = $0;
  3007.     return;
  3008.   }
  3009.   LANGUAGE_SPECIALS {
  3010.     language_print ($0);
  3011.   }
  3012. }
  3013.  
  3014. state html
  3015. {
  3016.   BEGIN {
  3017.     header ();
  3018.   }
  3019.   END {
  3020.     trailer ();
  3021.   }
  3022.  
  3023.   /* Scripts. */
  3024.   /<[sS][cC][rR][iI][pP][tT]/ {
  3025.     keyword_face (true);
  3026.     language_print ($0);
  3027.  
  3028.     /* The default script language is JavaScript. */
  3029.     html_script_language = "JavaScript";
  3030.     call (html_script_tag);
  3031.     keyword_face (false);
  3032.  
  3033.     if (strcmp (html_script_language, "JavaScript") == 0) {
  3034.       /* A nested JavaScript block. */
  3035.       from_html = 1;
  3036.       from_html_terminator = "";
  3037.       call (javascript);
  3038.       keyword_face (true);
  3039.       language_print (from_html_terminator);
  3040.       keyword_face (false);
  3041.     } else {
  3042.       /* An unknown scripting language, skip it. */
  3043.       from_html_terminator = "";
  3044.       call (html_skip_script);
  3045.       keyword_face (true);
  3046.       language_print (from_html_terminator);
  3047.       keyword_face (false);
  3048.     }
  3049.   }
  3050.  
  3051.   /</ {
  3052.     keyword_face (true);
  3053.     language_print ($0);
  3054.     call (html_tag);
  3055.     keyword_face (false);
  3056.   }
  3057.   /&/ {
  3058.     keyword_face (true);
  3059.     language_print ($0);
  3060.     call (html_entity);
  3061.     keyword_face (false);
  3062.   }
  3063.   LANGUAGE_SPECIALS {
  3064.     language_print ($0);
  3065.   }
  3066. }
  3067.  
  3068.  
  3069. /**
  3070.  * Name: idl
  3071.  * Description: IDL (CORBA Interface Definition Language)
  3072.  */
  3073.  
  3074. state idl
  3075. {
  3076.   BEGIN {
  3077.     header ();
  3078.   }
  3079.   END {
  3080.     trailer ();
  3081.   }
  3082.  
  3083.   /* Comments. */
  3084.   /\/\*/ {
  3085.     comment_face (true);
  3086.     language_print ($0);
  3087.     call (c_comment);
  3088.     comment_face (false);
  3089.   }
  3090.   /\/\// {
  3091.     comment_face (true);
  3092.     language_print ($0);
  3093.     call (eat_one_line);
  3094.     comment_face (false);
  3095.   }
  3096.  
  3097.   /* Character constants. */
  3098.   /'.'|'\\\\.'/ {
  3099.     string_face (true);
  3100.     language_print ($0);
  3101.     string_face (false);
  3102.   }
  3103.  
  3104.   /* String constants. */
  3105.   /\"/ {
  3106.     string_face (true);
  3107.     language_print ($0);
  3108.     call (c_string);
  3109.     string_face (false);
  3110.   }
  3111.  
  3112.   /* Pre-processor lines. */
  3113.   /^#/ {
  3114.     reference_face (true);
  3115.     language_print ($0);
  3116.     call (c_ppline);
  3117.     reference_face (false);
  3118.   }
  3119.  
  3120.   /* Boolean literals */
  3121.   /\b(TRUE|FALSE)\b/ {
  3122.     string_face (true);
  3123.     language_print ($0);
  3124.     string_face (false);
  3125.   }
  3126.  
  3127.   /* Keywords.
  3128.     (build-re '(any attribute boolean case char const context default double
  3129.     enum exception fixed float in inout interface long module Object
  3130.     octet oneway out native raises readonly sequence short string struct switch
  3131.     typedef unsigned union void wchar wstring))
  3132.   */
  3133.   /\b(Object|a(ny|ttribute)|boolean|c(ase|har|on(st|text))|d(efault|ouble)\
  3134. |e(num|xception)|f(ixed|loat)|in(|out|terface)|long|module|native\
  3135. |o(ctet|neway|ut)|r(aises|eadonly)|s(equence|hort|tr(ing|uct)|witch)\
  3136. |typedef|un(ion|signed)|void|w(char|string))\b/ {
  3137.     keyword_face (true);
  3138.     language_print ($0);
  3139.     keyword_face (false);
  3140.   }
  3141.  
  3142.   LANGUAGE_SPECIALS {
  3143.     language_print ($0);
  3144.   }
  3145. }
  3146.  
  3147.  
  3148. /**
  3149.  * Name: java
  3150.  * Description: Java programming language.
  3151.  * Author: Paul Fisher <pnfisher@eos.ncsu.edu>
  3152.  */
  3153.  
  3154. state java
  3155. {
  3156.   BEGIN {
  3157.     header ();
  3158.   }
  3159.   END {
  3160.     trailer ();
  3161.   }
  3162.  
  3163.   /* Comments. */
  3164.   /\/\*/ {
  3165.     comment_face (true);
  3166.     language_print ($0);
  3167.     call (c_comment);
  3168.     comment_face (false);
  3169.   }
  3170.   /\/\// {
  3171.     comment_face (true);
  3172.     language_print ($0);
  3173.     call (eat_one_line);
  3174.     comment_face (false);
  3175.   }
  3176.  
  3177.   /* String constants. */
  3178.   /\"/ {
  3179.     string_face (true);
  3180.     language_print ($0);
  3181.     call (c_string);
  3182.     string_face (false);
  3183.   }
  3184.  
  3185.   /* Character constants. */
  3186.   /'.'|'\\\\.'/ {
  3187.     string_face (true);
  3188.     language_print ($0);
  3189.     string_face (false);
  3190.   }
  3191.  
  3192.   /* Keywords.
  3193.      (build-re '(abstract boolean break byte case catch char class
  3194.      const continue default do double else extends false final finally
  3195.      float for goto if implements import instanceof int interface long
  3196.      native new null package private protected public return short static
  3197.      super switch synchronized this throw throws transient true try void
  3198.      volatile while))
  3199.   */
  3200.   /\b(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\
  3201. |d(efault|o(|uble))|e(lse|xtends)|f(alse|inal(|ly)|loat|or)|goto\
  3202. |i(f|mp(lements|ort)|n(stanceof|t(|erface)))|long|n(ative|ew|ull)\
  3203. |p(ackage|r(ivate|otected)|ublic)|return\
  3204. |s(hort|tatic|uper|witch|ynchronized)|t(h(is|row(|s))|r(ansient|ue|y))\
  3205. |vo(id|latile)|while)\b/ {
  3206.     keyword_face (true);
  3207.     language_print ($0);
  3208.     keyword_face (false);
  3209.   }
  3210.  
  3211.   LANGUAGE_SPECIALS {
  3212.     language_print ($0);
  3213.   }
  3214. }
  3215.  
  3216.  
  3217. /**
  3218.  * Name: javascript
  3219.  * Description: JavaScript language.
  3220.  * Author: Markku Rossi <mtr@iki.fi>
  3221.  */
  3222.  
  3223. from_html = 0;
  3224.  
  3225. state javascript_string
  3226. {
  3227.   /\\\\./ {
  3228.     language_print ($0);
  3229.   }
  3230.   /[\']/ {
  3231.     language_print ($0);
  3232.     return;
  3233.   }
  3234.   LANGUAGE_SPECIALS {
  3235.     language_print ($0);
  3236.   }
  3237. }
  3238.  
  3239. state javascript
  3240. {
  3241.   BEGIN {
  3242.     if (!from_html)
  3243.       header ();
  3244.   }
  3245.   END {
  3246.     if (!from_html)
  3247.       trailer ();
  3248.   }
  3249.  
  3250.   /* Comments. */
  3251.   /\/\*/ {
  3252.     comment_face (true);
  3253.     language_print ($0);
  3254.     call (c_comment);
  3255.     comment_face (false);
  3256.   }
  3257.   /\/\// {
  3258.     comment_face (true);
  3259.     language_print ($0);
  3260.     call (eat_one_line);
  3261.     comment_face (false);
  3262.   }
  3263.  
  3264.   /* String constants. */
  3265.   /\"/ {
  3266.     string_face (true);
  3267.     language_print ($0);
  3268.     call (c_string);
  3269.     string_face (false);
  3270.   }
  3271.  
  3272.   /* '' strings. */
  3273.   /[\']/ {
  3274.     string_face (true);
  3275.     language_print ($0);
  3276.     call (javascript_string);
  3277.     string_face (false);
  3278.   }
  3279.  
  3280.   /* Function definitions. */
  3281.   /\b(function)([ \t]+)([A-Za-z\$_][A-Za-z\$_0-9]*)([ \t]*\()/ {
  3282.     keyword_face (true);
  3283.     language_print ($1);
  3284.     keyword_face (false);
  3285.  
  3286.     language_print ($2);
  3287.  
  3288.     function_name_face (true);
  3289.     language_print ($3);
  3290.     function_name_face (false);
  3291.  
  3292.     language_print ($4);
  3293.   }
  3294.  
  3295.   /* Keywords.
  3296.      (build-re '(
  3297.      abstract boolean break byte case catch char class const continue
  3298.      default do double else extends false final finally float for function
  3299.      goto if implements import in instanceof int interface long native new
  3300.      null package private protected public return short static super switch
  3301.      synchronized this throw throws transient true try var void while with
  3302.      ))
  3303.    */
  3304.   /\b(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\
  3305. |d(efault|o(|uble))|e(lse|xtends)|f(alse|inal(|ly)|loat|or|unction)\
  3306. |goto|i(f|mp(lements|ort)|n(|stanceof|t(|erface)))|long\
  3307. |n(ative|ew|ull)|p(ackage|r(ivate|otected)|ublic)|return\
  3308. |s(hort|tatic|uper|witch|ynchronized)|t(h(is|row(|s))|r(ansient|ue|y))\
  3309. |v(ar|oid)|w(hile|ith))\b/ {
  3310.     keyword_face (true);
  3311.     language_print ($0);
  3312.     keyword_face (false);
  3313.   }
  3314.  
  3315.   /* Built-in objects.
  3316.      (build-re '(Math Date eval parseInt parseFloat))
  3317.    */
  3318.   /\b(Date|Math|eval|parse(Float|Int))\b/ {
  3319.     builtin_face (true);
  3320.     language_print ($0);
  3321.     builtin_face (false);
  3322.   }
  3323.  
  3324.   /* Terminator for nested JavaScript programs. */
  3325.   /<\/[sS][cC][rR][iI][pP][tT]>/ {
  3326.     from_html_terminator = $0;
  3327.     return;
  3328.   }
  3329.  
  3330.   LANGUAGE_SPECIALS {
  3331.     language_print ($0);
  3332.   }
  3333. }
  3334.  
  3335.  
  3336. /**
  3337.  * Name: mail
  3338.  * Description: Mail and news articles.
  3339.  * Author: Markku Rossi <mtr@iki.fi>
  3340.  */
  3341.  
  3342. state mail_body
  3343. {
  3344.   BEGIN {
  3345.     reference_face (false);
  3346.   }
  3347.   /^[ \t]+>/ {
  3348.     reference_face (true);
  3349.     language_print ($0);
  3350.     call (eat_one_line);
  3351.     reference_face (false);
  3352.   }
  3353.   LANGUAGE_SPECIALS {
  3354.     language_print ($0);
  3355.   }
  3356. }
  3357.  
  3358. state mail
  3359. {
  3360.   BEGIN {
  3361.     header ();
  3362.     reference_face (true);
  3363.   }
  3364.   END {
  3365.     trailer ();
  3366.   }
  3367.  
  3368.   /^[ \t]*$/ {
  3369.     /* Move to the mail body. */
  3370.     call (mail_body);
  3371.   }
  3372.   LANGUAGE_SPECIALS {
  3373.     language_print ($0);
  3374.   }
  3375. }
  3376.  
  3377.  
  3378. /**
  3379.  * Name: makefile
  3380.  * Description: Make program's definition files.
  3381.  * Author: Markku Rossi <mtr@iki.fi>
  3382.  */
  3383.  
  3384. state sh_eat_to_apostrophe
  3385. {
  3386.   /\'/ {
  3387.     language_print ($0);
  3388.     return;
  3389.   }
  3390.   LANGUAGE_SPECIALS {
  3391.     language_print ($0);
  3392.   }
  3393. }
  3394.  
  3395. state sh_eat_to_grave
  3396. {
  3397.   /`/ {
  3398.     language_print ($0);
  3399.     return;
  3400.   }
  3401.   LANGUAGE_SPECIALS {
  3402.     language_print ($0);
  3403.   }
  3404. }
  3405.  
  3406. state makefile
  3407. {
  3408.   BEGIN {
  3409.     header ();
  3410.   }
  3411.   END {
  3412.     trailer ();
  3413.   }
  3414.  
  3415.   /* Comments. */
  3416.   /#/ {
  3417.     comment_face (true);
  3418.     language_print ($0);
  3419.     call (eat_one_line);
  3420.     comment_face (false);
  3421.   }
  3422.   /* An escaped double quote, this doesn't start a string constant. */
  3423.   /\\\"/ {
  3424.     language_print ($0);
  3425.   }
  3426.  
  3427.   /* String constants. */
  3428.   /\"/ {
  3429.     string_face (true);
  3430.     language_print ($0);
  3431.     call (c_string);
  3432.     string_face (false);
  3433.   }
  3434.  
  3435.   /* Shell apostrophe quote. */
  3436.   /\'/ {
  3437.     string_face (true);
  3438.     language_print ($0);
  3439.     call (sh_eat_to_apostrophe);
  3440.     string_face (false);
  3441.   }
  3442.  
  3443.   /* Shell grave quote. */
  3444.   /`/ {
  3445.     string_face (true);
  3446.     language_print ($0);
  3447.     call (sh_eat_to_grave);
  3448.     string_face (false);
  3449.   }
  3450.  
  3451.   /* Variable references. */
  3452.  
  3453.   /\$\(/ {
  3454.     language_print ($0);
  3455.     reference_face (true);
  3456.     str = match_balanced_block (/\(/, /\)/);
  3457.     reference_face (false);
  3458.     language_print (str);
  3459.   }
  3460.  
  3461.   /\${/ {
  3462.     language_print ($0);
  3463.     reference_face (true);
  3464.     str = match_balanced_block (/{/, /}/);
  3465.     reference_face (false);
  3466.     language_print (str);
  3467.   }
  3468.  
  3469.   /* Targets. */
  3470.   /^[^ \t\r\n]+:/ {
  3471.     keyword_face (true);
  3472.     language_print ($0);
  3473.     keyword_face (false);
  3474.   }
  3475.   LANGUAGE_SPECIALS {
  3476.     language_print ($0);
  3477.   }
  3478. }
  3479.  
  3480.  
  3481. /**
  3482.  * Name: nroff
  3483.  * Description: Manual pages formatted with the nroff program.
  3484.  * Author: Markku Rossi <mtr@iki.fi>
  3485.  */
  3486.  
  3487. state nroff_italic
  3488. {
  3489.   BEGIN {
  3490.   }
  3491.   /_\010(.)/ {
  3492.     language_print ($1);
  3493.   }
  3494.   /([^_])\010.\010.\010./ {
  3495.     bold (true);
  3496.     language_print ($1);
  3497.     call (nroff_bold);
  3498.     bold (false);
  3499.     italic (true);
  3500.   }
  3501.   /.|\n/ {
  3502.     italic (false);
  3503.     language_print ($0);
  3504.     return;
  3505.   }
  3506.  
  3507.   LANGUAGE_SPECIALS {
  3508.     language_print ($0);
  3509.   }
  3510. }
  3511.  
  3512. state nroff_bold
  3513. {
  3514.   /([^_])\010.\010.\010./ {
  3515.     language_print ($1);
  3516.   }
  3517.   /_\010(.)/ {
  3518.     italic (true);
  3519.     language_print ($1);
  3520.     call (nroff_italic);
  3521.     italic (false);
  3522.     bold (true);
  3523.   }
  3524.   /.|\n/ {
  3525.     bold (false);
  3526.     language_print ($0);
  3527.     return;
  3528.   }
  3529.  
  3530.   LANGUAGE_SPECIALS {
  3531.     language_print ($0);
  3532.   }
  3533. }
  3534.  
  3535. state nroff
  3536. {
  3537.   BEGIN {
  3538.     header ();
  3539.   }
  3540.  
  3541.   END {
  3542.     trailer ();
  3543.   }
  3544.  
  3545.   /_\010(.)/ {
  3546.     italic (true);
  3547.     language_print ($1);
  3548.     call (nroff_italic);
  3549.   }
  3550.   /([^_])\010.\010.\010./ {
  3551.     bold (true);
  3552.     language_print ($1);
  3553.     call (nroff_bold);
  3554.   }
  3555.  
  3556.   LANGUAGE_SPECIALS {
  3557.     language_print ($0);
  3558.   }
  3559. }
  3560.  
  3561.  
  3562. /**
  3563.  * Name: objc
  3564.  * Description: Objective-C programming language.
  3565.  * Author: Markku Rossi <mtr@iki.fi> with help of Emacs' `font-lock.el'.
  3566.  */
  3567.  
  3568. objc_keyword_re =
  3569. /* Keywords.    Basicly C + some extras, *but* not goto and case.
  3570.    (build-re '(break continue default do else for if return sizeof
  3571.    switch while self super _cmd id Class SEL IMP BOOL YES NO nil Nil))
  3572.  */
  3573.   /\b(BOOL|Class|IMP|N(O|il)|SEL|YES|_cmd|break|continue|d(efault|o)|else\
  3574. |for|i(d|f)|nil|return|s(elf|izeof|uper|witch)|while)\b/;
  3575.  
  3576. objc_type_re =
  3577. /* Types.
  3578.    (build-re '(auto extern register static typedef struct union enum
  3579.    signed unsigned short long int char float double void volatile
  3580.    const id oneway in out inout bycopy byref))
  3581.  */
  3582.   /\b(auto|by(copy|ref)|c(har|onst)|double|e(num|xtern)|float\
  3583. |i(d|n(|out|t))|long|o(neway|ut)|register|s(hort|igned|t(atic|ruct))\
  3584. |typedef|un(ion|signed)|vo(id|latile))\b/;
  3585.  
  3586.  
  3587. state objc_method_line
  3588. {
  3589.   /* Argument declarations after the method.
  3590.    $1      $2                       $3       $4 $5           $6      $7 */
  3591.   /([ \t]*)([A-Za-z_][A-Za-z_0-9]*)?(:[ \t]*)(\(([^)\n]+)\))?([ \t]*)([A-Za-z_][A-Za-z_0-9]*)/ {
  3592.     language_print ($1);
  3593.  
  3594.     if (length ($2) > 0)
  3595.       {
  3596.     function_name_face (true);
  3597.     language_print ($2);
  3598.     function_name_face (false);
  3599.       }
  3600.  
  3601.     language_print ($3);
  3602.  
  3603.     if (length ($4) > 0)
  3604.       {
  3605.     language_print ("(");
  3606.     type_face (true);
  3607.     language_print ($5);
  3608.     type_face (false);
  3609.     language_print (")");
  3610.       }
  3611.  
  3612.     language_print ($6);
  3613.  
  3614.     variable_name_face (true);
  3615.     language_print ($7);
  3616.     variable_name_face (false);
  3617.   }
  3618.  
  3619.   /\n/ {
  3620.     language_print ($0);
  3621.     return;
  3622.   }
  3623.  
  3624.   LANGUAGE_SPECIALS {
  3625.     language_print ($0);
  3626.   }
  3627. }
  3628.  
  3629. state objc_method_continuation_line
  3630. {
  3631.   /* Method names and arguments on lines following the function declaration.
  3632.     $1      $2                       $3       $4 $5           $6      $7 */
  3633.   /^([ \t]*)([A-Za-z_][A-Za-z_0-9]*)?(:[ \t]*)(\(([^)\n]+)\))?([ \t]*)\
  3634. ([A-Za-z_][A-Za-z_0-9]*)/ {
  3635.     language_print ($1);
  3636.  
  3637.     if (length ($2) > 0)
  3638.       {
  3639.         function_name_face (true);
  3640.         language_print ($2);
  3641.         function_name_face (false);
  3642.       }
  3643.  
  3644.     language_print ($3);
  3645.  
  3646.     if (length ($4) > 0)
  3647.       {
  3648.         language_print ("(");
  3649.         type_face (true);
  3650.         language_print ($5);
  3651.         type_face (false);
  3652.         language_print (")");
  3653.       }
  3654.  
  3655.     language_print ($6);
  3656.  
  3657.     variable_name_face (true);
  3658.     language_print ($7);
  3659.     variable_name_face (false);
  3660.  
  3661.     /* Highlight all remaining arguments on this line. */
  3662.     call (objc_method_line);
  3663.   }
  3664.  
  3665.   /*
  3666.    * If the previous one didn't match, we'r done with this method
  3667.    * declaration.
  3668.    */
  3669.   /()/ {
  3670.     return;
  3671.   }
  3672. }
  3673.  
  3674. state objc_compiler_directive_line
  3675. {
  3676.   /([ \t:<(,]*)([A-Za-z_][A-Za-z_0-9]*)/ {
  3677.     language_print ($1);
  3678.  
  3679.     function_name_face (true);
  3680.     language_print ($2);
  3681.     function_name_face (false);
  3682.   }
  3683.  
  3684.   /*
  3685.    * If the previous one didn't match, we'r done with this directive.
  3686.    * Yes, that should match an empty string.
  3687.    */
  3688.   /()/ {
  3689.     return;
  3690.   }
  3691. }
  3692.  
  3693. state objc
  3694. {
  3695.   BEGIN {
  3696.     if (need_version (1, 5, 1))
  3697.       objc_function_name_re
  3698.     = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/;
  3699.     else
  3700.       objc_function_name_re = 0;
  3701.  
  3702.     header ();
  3703.   }
  3704.   END {
  3705.     trailer ();
  3706.   }
  3707.  
  3708.   /* Comments. */
  3709.   /\/\*/ {
  3710.     comment_face (true);
  3711.     language_print ($0);
  3712.     call (c_comment);
  3713.     comment_face (false);
  3714.   }
  3715.   /\/\// {
  3716.     comment_face (true);
  3717.     language_print ($0);
  3718.     call (eat_one_line);
  3719.     comment_face (false);
  3720.   }
  3721.  
  3722.   /* String constants. */
  3723.   /\"/ {
  3724.     string_face (true);
  3725.     language_print ($0);
  3726.     call (c_string);
  3727.     string_face (false);
  3728.   }
  3729.  
  3730.   /* Pre-processor lines. */
  3731.   /^#/ {
  3732.     language_print ($0);
  3733.     call (c_ppline);
  3734.   }
  3735.  
  3736.   /* Compiler directives. */
  3737.   /(@)([A-Za-z][A-Za-z0-9]*)\>/ {
  3738.     /* Leading garbage. */
  3739.     language_print ($1);
  3740.  
  3741.     /* The directive. */
  3742.     keyword_face (true);
  3743.     language_print ($2);
  3744.     keyword_face (false);
  3745.  
  3746.     /* And all the remaining stuff on this line. */
  3747.     call (objc_compiler_directive_line);
  3748.   }
  3749.  
  3750.   /* Character constants. */
  3751.   /'.'|'\\\\.'/ {
  3752.     string_face (true);
  3753.     language_print ($0);
  3754.     string_face (false);
  3755.   }
  3756.  
  3757.   /* Keywords. */
  3758.   objc_keyword_re {
  3759.     keyword_face (true);
  3760.     language_print ($0);
  3761.     keyword_face (false);
  3762.   }
  3763.  
  3764.   /* Types. */
  3765.  objc_type_re {
  3766.     type_face (true);
  3767.     language_print ($0);
  3768.     type_face (false);
  3769.   }
  3770.  
  3771.   /* Method names.  First, on the same line as the function declaration.
  3772.    $1           $2        $3      $4 $5           $6      $7 */
  3773.   /(^[+-][ \t]*)(PRIVATE)?([ \t]*)(\(([^)\n]+)\))?([ \t]*)([A-Za-z_]\
  3774. [A-Za-z_0-9]*)/ {
  3775.     language_print ($1);
  3776.  
  3777.     if (length ($2) > 0)
  3778.       {
  3779.     type_face (true);
  3780.     language_print ($2);
  3781.     type_face (false);
  3782.       }
  3783.  
  3784.     language_print ($3);
  3785.  
  3786.     if (length ($4) > 0)
  3787.       {
  3788.     language_print ("(");
  3789.     type_face (true);
  3790.     language_print ($5);
  3791.     type_face (false);
  3792.     language_print (")");
  3793.       }
  3794.  
  3795.     language_print ($6);
  3796.  
  3797.     function_name_face (true);
  3798.     language_print ($7);
  3799.     function_name_face (false);
  3800.  
  3801.     /* Highlight arguments from the same line. */
  3802.     call (objc_method_line);
  3803.  
  3804.     /*
  3805.      * Method names and arguments on lines following the function declaration.
  3806.      */
  3807.     call (objc_method_continuation_line);
  3808.   }
  3809.  
  3810.   /*
  3811.    * Labels and case tags.  These must remain as a sole statement on a line,
  3812.    * otherwise we detect selectors.  Emacs accepts also bare numbers.
  3813.    */
  3814.   /^([ \t]*)([a-zA-Z0-9_]+)(:[ \t]*)$/ {
  3815.     language_print ($1);
  3816.     if (strcmp ($2, "default") == 0)
  3817.       {
  3818.     /* `default' is a keyword. */
  3819.     keyword_face (true);
  3820.     language_print ($2);
  3821.     keyword_face (false);
  3822.       }
  3823.     else
  3824.       {
  3825.     reference_face (true);
  3826.     language_print ($2);
  3827.     reference_face (false);
  3828.       }
  3829.  
  3830.     language_print ($3);
  3831.   }
  3832.  
  3833.   /* Goto, case and the target. */
  3834.   /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ {
  3835.     keyword_face (true);
  3836.     language_print ($1);
  3837.     keyword_face (false);
  3838.  
  3839.     language_print ($2);
  3840.  
  3841.     if (length ($3) > 0)
  3842.       {
  3843.     reference_face (true);
  3844.     language_print ($3);
  3845.     reference_face (false);
  3846.       }
  3847.   }
  3848.  
  3849.   /*
  3850.    * Function definitions, but only if you code with the one and only
  3851.    * usable indentation style (GNU).
  3852.    */
  3853.   /^([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/ {
  3854.     function_name_face (true);
  3855.     language_print ($1);
  3856.     function_name_face (false);
  3857.  
  3858.     language_print ($2);
  3859.   }
  3860.  
  3861.   /* Function definitions and prototypes for other (loser) coding styles. */
  3862.   objc_function_name_re {
  3863.     garbage = $1;
  3864.     middle_garbage = $2;
  3865.     function_name = $3;
  3866.     tail_garbage = $4;
  3867.  
  3868.     highlight_types (garbage, objc_type_re);
  3869.  
  3870.     language_print (middle_garbage);
  3871.  
  3872.     function_name_face (true);
  3873.     language_print (function_name);
  3874.     function_name_face (false);
  3875.  
  3876.     language_print (tail_garbage);
  3877.   }
  3878.  
  3879.   LANGUAGE_SPECIALS {
  3880.     language_print ($0);
  3881.   }
  3882. }
  3883.  
  3884.  
  3885. /**
  3886.  * Name: pascal
  3887.  * Description: Pascal programming language
  3888.  * Author: Michael Van Canneyt <michael@tfdec1.fys.kuleuven.ac.be>
  3889.  */
  3890.  
  3891. state pascal_comment
  3892. {
  3893.   /(\}|\*\))/ {
  3894.     language_print ($0);
  3895.     return;
  3896.   }
  3897.   LANGUAGE_SPECIALS {
  3898.     language_print ($0);
  3899.   }
  3900. }
  3901.  
  3902. state pascal_string
  3903. {
  3904.   /[\']/ {
  3905.     language_print ($0);
  3906.     return;
  3907.   }
  3908.   LANGUAGE_SPECIALS {
  3909.     language_print ($0);
  3910.   }
  3911. }
  3912.  
  3913. state pascal
  3914. {
  3915.   BEGIN {
  3916.     header ();
  3917.   }
  3918.   END {
  3919.     trailer ();
  3920.   }
  3921.   /* comments */
  3922.   /(\{|\(\*)/ {
  3923.     comment_face (true);
  3924.     language_print ($0);
  3925.     call (pascal_comment);
  3926.     comment_face (false);
  3927.   }
  3928.   /* strings */
  3929.   /[\']/ {
  3930.     string_face (true);
  3931.     language_print ($0);
  3932.     call (pascal_string);
  3933.     string_face (false);
  3934.   }
  3935.   /* Keywords.
  3936.      (build-re '(and asm array begin case const constructor destructor div
  3937.      do downto else end file for function goto if implementation in inline
  3938.      interface label mod nil not object of or packed procedure program record
  3939.      repeat set shlr string then to type unit until uses var while with xor)
  3940.      t)
  3941.    */
  3942.   /\b([aA]([nN][dD]|[rR][rR][aA][yY]|[sS][mM])|[bB][eE][gG][iI][nN]\
  3943. |[cC]([aA][sS][eE]|[oO][nN][sS][tT](|[rR][uU][cC][tT][oO][rR]))\
  3944. |[dD]([eE][sS][tT][rR][uU][cC][tT][oO][rR]|[iI][vV]|[oO](|[wW][nN][tT][oO]))\
  3945. |[eE]([lL][sS][eE]|[nN][dD])\
  3946. |[fF]([iI][lL][eE]|[oO][rR]|[uU][nN][cC][tT][iI][oO][nN])\
  3947. |[gG][oO][tT][oO]\
  3948. |[iI]([fF]|[mM][pP][lL][eE][mM][eE][nN][tT][aA][tT][iI][oO][nN]\
  3949. |[nN](|[lL][iI][nN][eE]|[tT][eE][rR][fF][aA][cC][eE]))\
  3950. |[lL][aA][bB][eE][lL]|[mM][oO][dD]|[nN]([iI][lL]|[oO][tT])\
  3951. |[oO]([bB][jJ][eE][cC][tT]|[fF]|[rR])\
  3952. |[pP]([aA][cC][kK][eE][dD]\
  3953. |[rR][oO]([cC][eE][dD][uU][rR][eE]|[gG][rR][aA][mM]))\
  3954. |[rR][eE]([cC][oO][rR][dD]|[pP][eE][aA][tT])\
  3955. |[sS]([eE][tT]|[hH][lL][rR]|[tT][rR][iI][nN][gG])\
  3956. |[tT]([hH][eE][nN]|[oO]|[yY][pP][eE])\
  3957. |[uU]([nN]([iI][tT]|[tT][iI][lL])|[sS][eE][sS])|[vV][aA][rR]\
  3958. |[wW]([hH][iI][lL][eE]|[iI][tT][hH])|[xX][oO][rR])\b/ {
  3959.   keyword_face (true);
  3960.   language_print ($0);
  3961.   keyword_face (false);
  3962.   }
  3963. }
  3964.  
  3965.  
  3966. /**
  3967.  * Name: perl
  3968.  * Description: Perl programming language.
  3969.  *
  3970.  * Author: Jim Villani, Logistics Management Institute (jvillani@lmi.org)
  3971.  */
  3972.  
  3973. state perl_comment
  3974. {
  3975.   /\*\\\// {
  3976.     language_print ($0);
  3977.     return;
  3978.   }
  3979.   LANGUAGE_SPECIALS {
  3980.    language_print ($0);
  3981.   }
  3982. }
  3983.  
  3984. state perl_dquot_string
  3985. {
  3986.   /\\\\./ {
  3987.     language_print ($0);
  3988.   }
  3989.   /\"/ {
  3990.     language_print ($0);
  3991.     return;
  3992.   }
  3993.   LANGUAGE_SPECIALS {
  3994.     language_print ($0);
  3995.   }
  3996. }
  3997.  
  3998. state perl_quot_string
  3999. {
  4000.   /\\\\./ {
  4001.     language_print ($0);
  4002.   }
  4003.   /[\']/ {
  4004.     language_print ($0);
  4005.     return;
  4006.   }
  4007.   LANGUAGE_SPECIALS {
  4008.     language_print ($0);
  4009.   }
  4010. }
  4011.  
  4012. state perl_bquot_string
  4013. {
  4014.   /\\\\./ {
  4015.     language_print ($0);
  4016.   }
  4017.   /`/ {
  4018.     language_print ($0);
  4019.     return;
  4020.   }
  4021.   LANGUAGE_SPECIALS {
  4022.     language_print ($0);
  4023.   }
  4024. }
  4025.  
  4026. state perl
  4027. {
  4028.   BEGIN {
  4029.     header ();
  4030.   }
  4031.   END {
  4032.     trailer ();
  4033.   }
  4034.  
  4035.   /* Comments. */
  4036.   /#.*$/ {
  4037.     comment_face (true);
  4038.     language_print ($0);
  4039.     comment_face (false);
  4040.   }
  4041.  
  4042.   /* Ignore escaped quote marks */
  4043.   /\\\"/ {
  4044.     language_print ($0);
  4045.   }
  4046.   /\\\'/ {
  4047.     language_print ($0);
  4048.   }
  4049.   /\\\`/ {
  4050.     language_print ($0);
  4051.   }
  4052.  
  4053.   /* stuff after a -> is a method,
  4054.    * don't bold just because it looks like a keyword
  4055.    */
  4056.   /->\w+/ {
  4057.     language_print ($0);
  4058.   }
  4059.  
  4060.   /* stuff between a - and a => is a named parameter,
  4061.    * don't bold just because it looks like a keyword
  4062.    */
  4063.   /-\w+=>/ {
  4064.     language_print ($0);
  4065.   }
  4066.  
  4067.   /* In cgi files, JavaScript might be imbedded, so we need to look out
  4068.    * for the JavaScript comments, because they might contain something
  4069.    * we don't like, like a contraction (don't, won't, etc.)
  4070.    * We won't put them in comment face, because they are not perl
  4071.    * comments.
  4072.    */
  4073.   /\/\// {
  4074.     language_print ($0);
  4075.     call (eat_one_line);
  4076.   }
  4077.  
  4078.   /* String constants. */
  4079.   /\"/ {
  4080.     string_face (true);
  4081.     language_print ($0);
  4082.     call (perl_dquot_string);
  4083.     string_face (false);
  4084.   }
  4085.   /[\']/ {
  4086.     string_face (true);
  4087.     language_print ($0);
  4088.     call (perl_quot_string);
  4089.     string_face (false);
  4090.   }
  4091.  
  4092.   /* Backquoted command string */
  4093.   /`/ {
  4094.     string_face (true);
  4095.     language_print ($0);
  4096.     call (perl_bquot_string);
  4097.     string_face (false);
  4098.   }
  4099.  
  4100.   /* Variables */
  4101.   /[$%@&]+\w+/ {
  4102.     keyword_face (false);
  4103.     language_print ($0);
  4104.   }
  4105.  
  4106.   /* Keywords. From perl distribution's toke.c
  4107.      abs accept alarm and atan2 bind binmode bless caller chdir chmod
  4108.      chomp chop chown chr chroot close closedir cmp connect continue cos
  4109.      crypt dbmclose dbmopen defined delete die do dump each else elsif
  4110.      endgrent endhostent endnetent endprotoent endpwent endservent eof
  4111.      eq eval exec exists exit exp fcntl fileno flock for foreach fork
  4112.      format formline ge getc getgrent getgrgid getgrnam gethostbyaddr
  4113.      gethostbyname gethostent getlogin getnetbyaddr getnetbyname
  4114.      getnetent getpeername getpgrp getppid getpriority getprotobyname
  4115.      getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname
  4116.      getservbyport getservent getsockname getsockopt glob gmtime goto
  4117.      grep gt hex if index int ioctl join keys kill last lc lcfirst le
  4118.      length link listen local localtime log lstat lt m map mkdir msgctl
  4119.      msgget msgrcv msgsnd my ne new next no not oct open opendir or ord
  4120.      pack package pipe pop pos print printf prototype push q qq quotemeta
  4121.      qw qx rand read readdir readline readlink readpipe recv redo ref
  4122.      rename require reset return reverse rewinddir rindex rmdir s scalar
  4123.      seek seekdir select semctl semget semop send setgrent sethostent
  4124.      setnetent setpgrp setpriority setprotoent setpwent setservent
  4125.      setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep
  4126.      socket socketpair sort splice split sprintf sqrt srand stat study
  4127.      sub substr symlink syscall sysopen sysread sysseek system syswrite
  4128.      tell telldir tie tied time times tr truncate uc ucfirst umask undef
  4129.      unless unlink unpack unshift untie until use utime values vec wait
  4130.      waitpid wantarray warn while write x xor y
  4131.    */
  4132.   /\b(a(bs|ccept|larm|nd|tan2)|b(in(d|mode)|less)|c(aller|h(dir|mod\
  4133. |o(mp|p|wn)|r(|oot))|lose(|dir)|mp|o(n(nect|tinue)|s)|rypt)\
  4134. |d(bm(close|open)|e(fined|lete)|ie|o|ump)|e(ach|ls(e|if)|nd(gr|host|net|proto\
  4135. |pw|serv)ent|of|q|val|x(ec|i(sts|t)|p))|f(cntl|ileno|lock|or(|each|k\
  4136. |m(at|line)))|g(e(|t(c|gr(ent|gid|nam)|host(by(addr|name)|ent)|login\
  4137. |net(by(addr|name)|ent)|p(eername|grp|pid|riority|roto(by(addr|name|number)\
  4138. |ent)|w(ent|nam|uid))|s(erv(by(name|port)|ent)|ock(name|opt))))|lob|mtime\
  4139. |oto|rep|t)|hex|i(f|n(t|dex)|octl)|join|k(eys|ill)|l(ast|c(|first)|e(|ngth)\
  4140. |i(nk|sten)|o(cal(|time)|g)|stat|t)|m|m(ap|kdir|sg(ctl|get|rcv|snd)|y)\
  4141. |n(e(|w|xt)|o(|t))|o(ct|pen(|dir)|r(|d))|p(ack(|age)|ipe|o(p|s)|r(int(|f)\
  4142. |ototype)|ush)|q(|q|uotemeta|w|x)|r(and|e(a(d(|dir|lin(e|k)|pipe))|cv\
  4143. |do|f|name|quire|set|turn|verse|winddir)|index|mdir)|s(|calar|e(e(k|kdir)\
  4144. |lect|m(ctl|get|op)|nd|t((gr|host|net)ent|p(grp|r(iority|otoent)|went)\
  4145. |s(ervent|ockopt)))|h(ift|m(ctl|get|read|write)|utdown)|in|leep|o(cke(t|tpair)\
  4146. |rt)|p(li(ce|t)|rintf)|qrt|rand|t(at|udy)|u(b|bstr)|y(mlink|s(call|open|read\
  4147. |s(eek|tem)|write)))|t(ell(|dir)|i(e|ed|m(e|es))|r(|uncate))|u(c(|first)\
  4148. |mask|n(def|l(ess|ink)|pack|shift|ti(e|l))|se|time)|v(alues|ec)|w(a(i(t(|pid))\
  4149. |ntarray|rn)|hile|rite)|x(|or)|y)\b/ {
  4150.  
  4151.     keyword_face (true);
  4152.     language_print ($0);
  4153.     keyword_face (false);
  4154.   }
  4155.  
  4156.   LANGUAGE_SPECIALS {
  4157.     language_print ($0);
  4158.   }
  4159. }
  4160.  
  4161.  
  4162. /**
  4163.  * Name: postscript
  4164.  * Description: PostScript programming language.
  4165.  *
  4166.  * Author: Dave Hylands (DHylands@creo.com)
  4167.  */
  4168.  
  4169. state ps_string
  4170. {
  4171.   /\\\\./ {
  4172.     language_print ($0);
  4173.   }
  4174.   /[\)]/ {
  4175.     language_print ($0);
  4176.     return;
  4177.   }
  4178.   /[\(]/ {
  4179.     /* Balanced ()'s in a string */
  4180.     language_print ($0);
  4181.     call (ps_string);
  4182.   }
  4183.   LANGUAGE_SPECIALS {
  4184.     language_print ($0);
  4185.   }
  4186. }
  4187.  
  4188. state ps_encoded_string
  4189. {
  4190.   /[\>]/ {
  4191.     language_print ($0);
  4192.     return;
  4193.   }
  4194.   LANGUAGE_SPECIALS {
  4195.     language_print ($0);
  4196.   }
  4197. }
  4198.  
  4199. state postscript
  4200. {
  4201.   BEGIN {
  4202.     header ();
  4203.   }
  4204.   END {
  4205.     trailer ();
  4206.   }
  4207.  
  4208.   /* Comments. */
  4209.   /%/ {
  4210.     comment_face (true);
  4211.     language_print ($0);
  4212.     call (eat_one_line);
  4213.     comment_face (false);
  4214.   }
  4215.  
  4216.   /* String constants. */
  4217.   /[\(]/ {
  4218.     string_face (true);
  4219.     language_print ($0);
  4220.     call (ps_string);
  4221.     string_face (false);
  4222.   }
  4223.  
  4224.   /[\<]/ {
  4225.     string_face (true);
  4226.     language_print ($0);
  4227.     call (ps_encoded_string);
  4228.     string_face (false);
  4229.   }
  4230.  
  4231.   /* Keywords.
  4232.  
  4233.      I built the keyword list using the following PostScript program
  4234.  
  4235.     /str 128 string def
  4236.     /outFile \(ps.txt)(w)file def
  4237.     /proc
  4238.     {
  4239.         pop //str cvs outFile exch writestring outFile (\n) writestring
  4240.     } bind def
  4241.  
  4242.     systemdict /proc load forall
  4243.     statusdict /proc load forall
  4244.     errordict  /proc load forall
  4245.  
  4246.     I then ran:
  4247.  
  4248.     sort ps.txt | uniq | fmt > ps.key
  4249.  
  4250.     I then went through the list and removed << >> [ ] and obvious Harlequin
  4251.     extensions. Many of the keywords remaining are not documented in the Red
  4252.     Book but are implemented in some Adobe implementations (especially the
  4253.     ones from statusdict). I decided to leave them in.
  4254.  
  4255.     And since I don't have emacs (gasp), I wrote a program which takes the
  4256.     ps.key file and generates the regular expression. This was faster than
  4257.     trying to install emacs and figure out how it works.
  4258.  
  4259.     Also note that PostScript doesn't require whitespace in front of keywords.
  4260.     In particular, text can follow immediately after any of the following
  4261.     characters:
  4262.  
  4263.     > { } ) [ ] /
  4264.  
  4265.     and can be followed immediately by the following:
  4266.  
  4267.     < { } ( [ ] /
  4268.  
  4269.     in addition to white space.
  4270.  
  4271.     Contents of ps.key:
  4272.  
  4273.     $error .error 11x17tray 12x24tray 15x24tray = == =print =scratch =string
  4274.     FontDirectory GlobalFontDirectory ISOLatin1Encoding
  4275.     Run SharedFontDirectory SpecialRun StandardEncoding
  4276.     VMerror a2tray a3tray a4tray a5tray abs add aload
  4277.     anchorsearch and appletalktype arc arcn arct arcto array ashow astore
  4278.     atan authors awidthshow b5tray begin bind bitshift blackoverprint blink
  4279.     broadsheettray buildtime bytesavailable cachestatus ceiling cexec
  4280.     charpath checkpassword checkscreen clear cleardictstack clearinterrupt
  4281.     cleartomark clip clippath closefile closepath closescc colorimage concat
  4282.     concatmatrix configurationerror copy copypage cos count countdictstack
  4283.     countexecstack counttomark cshow currentblackgeneration
  4284.     currentcacheparams currentcmykcolor currentcolor currentcolorrendering
  4285.     currentcolorrenderingintent currentcolorscreen currentcolorspace
  4286.     currentcolortransfer currentdash currentdevparams currentdict
  4287.     currentdlhooks currentfile currentflat currentfont currentglobal
  4288.     currentgray currentgstate currenthalftone currenthalftonephase
  4289.     currenthsbcolor currentinterceptcolorspace currentlinecap
  4290.     currentlinejoin currentlinewidth currentmatrix currentmiterlimit
  4291.     currentobjectformat currentoverprint currentpacking currentpagedevice
  4292.     currentpoint currentrelativeneutrals currentreproductioncriteria
  4293.     currentrgbcolor currentscreen currentseparationcolornames
  4294.     currentseparationorder currentshared currentstrokeadjust
  4295.     currentsystemparams currenttransfer currenttrapintent
  4296.     currentundercolorremoval currentuserparams curveto cvi cvlit cvn cvr
  4297.     cvrs cvs cvx daytime def defaultblackoverprint
  4298.     defaulthandleerror defaultmatrix defaultmirrorprint defaultpagemargin
  4299.     defaultpageparams defaultprocesscolors defaulttimeouts definefont
  4300.     defineresource defineuserobject deletefile devdismount devforall
  4301.     devformat deviceinfo devmount devstatus dict dictfull dictstack
  4302.     dictstackoverflow dictstackunderflow disableinterrupt diskonline
  4303.     diskstatus div dlclearcaches dostartpage dosysstart dtransform dup echo
  4304.     eerom eescratch eexec enableinterrupt end endofjob eoclip eofill eq
  4305.     erasepage errorbeep errordict exch exec execdict execform execstack
  4306.     execstackoverflow execuserobject executeonly executive exit exp exposure
  4307.     false file filekind filelinenumber filename filenameforall fileposition
  4308.     fill filter findcharstrings findcolorrenderingintent findencoding
  4309.     findfont findpgfont findresource flattenpath floor flush flushcache
  4310.     flushfile for forall gcheck ge genericpaper get getinterval getknown
  4311.     getsccconfig gettopfile gettoprealfile globaldict glyphshow grestore
  4312.     grestoreall gsave gstate gt handleerror hardwareiomode
  4313.     identmatrix idiv idlefonts idtransform if ifelse
  4314.     image imagemask index ineofill infill initclip initgraphics initialized
  4315.     initializedisk initmatrix instroke internaldict interrupt
  4316.     interruptenabled inueofill inufill inustroke invalidaccess invalidexit
  4317.     invalidfileaccess invalidfont invalidrestore invertmatrix ioerror
  4318.     ismanualfeed itransform jobname jobsource jobstate jobstring jobtimeout
  4319.     known kshow languagelevel lastmode le ledgertray legaltray length
  4320.     lettertray limitcheck lineto listfilesinestack ln load
  4321.     loadcurrentpagedevice loadsetpagedevice log loop lt makefont makepattern
  4322.     manualfeedtimeout margins mark matchtemplate matrix maxlength
  4323.     medialength mediasize mediawidth mirrorprint mod moveto mul ne neg
  4324.     negativeprint newpath noaccess nocurrentpoint not null nulldevice
  4325.     openscc or packedarray pagecount pagemargin pageparams pagestackorder
  4326.     pagetype pathbbox pathforall pop print printererror printermessage
  4327.     printername printerstatus printerupset printobject processcolors product
  4328.     prompt pstack put putinterval quit ramsize rand rangecheck rcheck
  4329.     rcurveto read readhexstring readline readonly readstring realtime
  4330.     rectclip rectfill rectstroke renamefile repeat resetfile resetprinter
  4331.     resolution resourceforall resourcestatus restore reversepath revision
  4332.     rlineto rmoveto roll rootfont rotate round rrand run save scale
  4333.     scalefont sccbatch sccfiles sccinteractive scheck screenforall search
  4334.     selectfont sendctrld sendpcmd sendprinterstate serialnumber serverdict
  4335.     setaccuratescreens setbbox setblackgeneration setblackoverprint setblink
  4336.     setcachedevice setcachedevice2 setcachelimit setcacheparams setcharwidth
  4337.     setcmykcolor setcolor setcolorrendering setcolorrenderingintent
  4338.     setcolorscreen setcolorspace setcolortransfer setdash
  4339.     setdefaultblackoverprint setdefaultmirrorprint setdefaultpagemargin
  4340.     setdefaultpageparams setdefaultprocesscolors setdefaulttimeouts
  4341.     setdevparams setdlhooks setdostartpage setdosysstart seteescratch
  4342.     setexposure setfileposition setflat setfont setglobal setgray setgstate
  4343.     sethalftone sethalftonephase sethardwareiomode sethsbcolor setidlefonts
  4344.     setinterceptcolorspace setjobtimeout setlinecap setlinejoin setlinewidth
  4345.     setmargins setmatrix setmirrorprint setmiterlimit setnegativeprint
  4346.     setobjectformat setoverprint setpacking setpage setpagedevice
  4347.     setpagemargin setpageparams setpageseen setpagestackorder setpagetype
  4348.     setpassword setpattern setprintername setprocesscolors
  4349.     setrelativeneutrals setreproductioncriteria setresolution setrgbcolor
  4350.     setsccbatch setsccconfig setsccinteractive setscreen setshared
  4351.     setsoftwareiomode setstderr setstdio setstrokeadjust setsystemparams
  4352.     settransfer settrapintent setucacheparams setundercolorremoval
  4353.     setuserdiskpercent setuserparams setvmthreshold shareddict show showpage
  4354.     sin softwareiomode sqrt srand stack stackoverflow stackunderflow start
  4355.     startjob startpage status statuscommand statusdict stop stopped store
  4356.     string stringwidth stroke strokepath sub superstop superstopped
  4357.     switchsetting syntaxerror system systemdict tabloidtray timeout token
  4358.     transform translate true truncate type typecheck uappend ucache
  4359.     ucachestatus ueofill ufill undef undefined undefinedfilename
  4360.     undefinedresource undefinedresult undefinefont undefineresource
  4361.     undefineuserobject unmatchedmark unregistered upath userdict
  4362.     userdiskpercent usertime ustroke ustrokepath validatefont version
  4363.     vmreclaim vmstatus waittimeout wcheck where widthshow write
  4364.     writehexstring writeobject writestring xcheck xor xshow xyshow yshow
  4365.   */
  4366.   /(\b|[\>\{\}\)\[\]\/])\
  4367. (\$error|\.error|1(1x17tray|2x24tray|5x24tray)|=(|=|print|s(cratch|tring))\
  4368. |FontDirectory|GlobalFontDirectory|ISOLatin1Encoding|Run|S\
  4369. (haredFontDirectory|pecialRun|tandardEncoding)|VMerror|a(2tray|3tray\
  4370. |4tray|5tray|bs|dd|load|n(chorsearch|d)|ppletalktype|r(c(|n|t(|o))|ray)|s\
  4371. (how|tore)|tan|uthors|widthshow)|b(5tray|egin|i(nd|tshift)|l\
  4372. (ackoverprint|ink)|roadsheettray|uildtime|ytesavailable)|c(achestatus|e\
  4373. (iling|xec)|h(arpath|eck(password|screen))|l(ear(|dictstack|interrupt\
  4374. |tomark)|ip(|path)|ose(file|path|scc))|o(lorimage|n(cat(|matrix)\
  4375. |figurationerror)|py(|page)|s|unt(|dictstack|execstack|tomark))|show|ur\
  4376. (rent(blackgeneration|c(acheparams|mykcolor|olor(|rendering(|intent)|s\
  4377. (creen|pace)|transfer))|d(ash|evparams|ict|lhooks)|f(ile|lat|ont)|g(lobal\
  4378. |ray|state)|h(alftone(|phase)|sbcolor)|interceptcolorspace|line(cap|join\
  4379. |width)|m(atrix|iterlimit)|o(bjectformat|verprint)|p(a(cking|gedevice)\
  4380. |oint)|r(e(lativeneutrals|productioncriteria)|gbcolor)|s(creen|eparation\
  4381. (colornames|order)|hared|trokeadjust|ystemparams)|tra(nsfer|pintent)|u\
  4382. (ndercolorremoval|serparams))|veto)|v(i|lit|n|r(|s)|s|x))|d(aytime|e(f(\
  4383. |ault(blackoverprint|handleerror|m(atrix|irrorprint)|p(age(margin\
  4384. |params)|rocesscolors)|timeouts)|ine(font|resource|userobject))|letefile|v\
  4385. (dismount|for(all|mat)|iceinfo|mount|status))|i(ct(|full|stack(|overflow\
  4386. |underflow))|s(ableinterrupt|k(online|status))|v)|lclearcaches|os(tartpage\
  4387. |ysstart)|transform|up)|e(cho|e(rom|scratch|xec)|n(ableinterrupt|d(\
  4388. |ofjob))|o(clip|fill)|q|r(asepage|ror(beep|dict))|x(ch|ec(|dict|form|stack\
  4389. (|overflow)|u(serobject|t(eonly|ive)))|it|p(|osure)))|f(alse|i(l(e(|kind\
  4390. |linenumber|name(|forall)|position)|l|ter)|nd(c(harstrings\
  4391. |olorrenderingintent)|encoding|font|pgfont|resource))|l(attenpath|oor\
  4392. |ush(|cache|file))|or(|all))|g(check|e(|nericpaper|t(|interval|known\
  4393. |sccconfig|top(file|realfile)))|l(obaldict|yphshow)|restore(|all)|s(ave\
  4394. |tate)|t)|ha(ndleerror|rdwareiomode)|i(d(entmatrix|iv|lefonts|transform)\
  4395. |f(|else)|mage(|mask)|n(dex|eofill|fill|it(clip|graphics|ialized(|isk)\
  4396. |matrix)|stroke|ter(naldict|rupt(|enabled))|u(eofill|fill|stroke)|v(alid\
  4397. (access|exit|f(ileaccess|ont)|restore)|ertmatrix))|oerror|smanualfeed\
  4398. |transform)|job(name|s(ource|t(ate|ring))|timeout)|k(nown|show)|l(a\
  4399. (nguagelevel|stmode)|e(|dgertray|galtray|ngth|ttertray)|i(mitcheck|neto\
  4400. |stfilesinestack)|n|o(ad(|currentpagedevice|setpagedevice)|g|op)|t)|m(a\
  4401. (ke(font|pattern)|nualfeedtimeout|r(gins|k)|t(chtemplate|rix)|xlength)\
  4402. |edia(length|size|width)|irrorprint|o(d|veto)|ul)|n(e(|g(|ativeprint)\
  4403. |wpath)|o(access|currentpoint|t)|ull(|device))|o(penscc|r)|p(a(ckedarray\
  4404. |ge(count|margin|params|stackorder|type)|th(bbox|forall))|op|r(int(|er\
  4405. (error|message|name|status|upset)|object)|o(cesscolors|duct|mpt))|stack\
  4406. |ut(|interval))|quit|r(a(msize|n(d|gecheck))|c(heck|urveto)|e(a(d(\
  4407. |hexstring|line|only|string)|ltime)|ct(clip|fill|stroke)|namefile|peat|s\
  4408. (et(file|printer)|o(lution|urce(forall|status))|tore)|v(ersepath|ision))\
  4409. |lineto|moveto|o(ll|otfont|tate|und)|rand|un)|s(ave|c(ale(|font)|c(batch\
  4410. |files|interactive)|heck|reenforall)|e(arch|lectfont|nd(ctrld|p(cmd\
  4411. |rinterstate))|r(ialnumber|verdict)|t(accuratescreens|b(box|l(ack\
  4412. (generation|overprint)|ink))|c(ache(device(|2)|limit|params)|harwidth\
  4413. |mykcolor|olor(|rendering(|intent)|s(creen|pace)|transfer))|d(ash|e(fault\
  4414. (blackoverprint|mirrorprint|p(age(margin|params)|rocesscolors)|timeouts)\
  4415. |vparams)|lhooks|os(tartpage|ysstart))|e(escratch|xposure)|f(ileposition\
  4416. |lat|ont)|g(lobal|ray|state)|h(a(lftone(|phase)|rdwareiomode)|sbcolor)|i\
  4417. (dlefonts|nterceptcolorspace)|jobtimeout|line(cap|join|width)|m(a(rgins\
  4418. |trix)|i(rrorprint|terlimit))|negativeprint|o(bjectformat|verprint)|p(a\
  4419. (cking|ge(|device|margin|params|s(een|tackorder)|type)|ssword|ttern)|r\
  4420. (intername|ocesscolors))|r(e(lativeneutrals|productioncriteria|solution)\
  4421. |gbcolor)|s(c(c(batch|config|interactive)|reen)|hared|oftwareiomode|t(d\
  4422. (err|io)|rokeadjust)|ystemparams)|tra(nsfer|pintent)|u(cacheparams\
  4423. |ndercolorremoval|ser(diskpercent|params))|vmthreshold))|h(areddict|ow(\
  4424. |page))|in|oftwareiomode|qrt|rand|t(a(ck(|overflow|underflow)|rt(|job\
  4425. |page)|tus(|command|dict))|o(p(|ped)|re)|r(ing(|width)|oke(|path)))|u(b\
  4426. |perstop(|ped))|witchsetting|y(ntaxerror|stem(|dict)))|t(abloidtray|imeout\
  4427. |oken|r(ans(form|late)|u(e|ncate))|ype(|check))|u(append|cache(|status)\
  4428. |eofill|fill|n(def(|ine(d(|filename|res(ource|ult))|font|resource\
  4429. |userobject))|matchedmark|registered)|path|s(er(di(ct|skpercent)|time)\
  4430. |troke(|path)))|v(alidatefont|ersion|m(reclaim|status))|w(aittimeout|check\
  4431. |here|idthshow|rite(|hexstring|object|string))|x(check|or|show|yshow)\
  4432. |yshow)\
  4433. (\b|[\<\{\}\(\[\]\/])/ {
  4434.     keyword_face (true);
  4435.     language_print ($0);
  4436.     keyword_face (false);
  4437.   }
  4438.  
  4439.   LANGUAGE_SPECIALS {
  4440.     language_print ($0);
  4441.   }
  4442. }
  4443.  
  4444.  
  4445. /**
  4446.  * Name: python
  4447.  * Description: Python programming language.
  4448.  * Author: Andy Eskilsson <Andy.Eskilsson@telelogic.se>
  4449.  */
  4450.  
  4451. state python_string
  4452. {
  4453.   /\\\\./ {
  4454.     language_print ($0);
  4455.   }
  4456.   python_string_end {
  4457.     language_print ($0);
  4458.     return;
  4459.   }
  4460.   LANGUAGE_SPECIALS {
  4461.     language_print ($0);
  4462.   }
  4463. }
  4464.  
  4465. state python
  4466. {
  4467.   BEGIN {
  4468.     header ();
  4469.   }
  4470.   END {
  4471.     trailer ();
  4472.   }
  4473.  
  4474.   /* Comments. */
  4475.   /#/ {
  4476.     comment_face (true);
  4477.     language_print ($0);
  4478.     call (eat_one_line);
  4479.     comment_face (false);
  4480.   }
  4481.   /* Python strings */
  4482.   /(\"\"\"|[\'][\'][\'])/ {
  4483.     python_string_end = regexp($0);
  4484.     string_face (true);
  4485.     language_print ($0);
  4486.     call (python_string);
  4487.     string_face (false);
  4488.   }
  4489.  
  4490.   /(\"|[\'])/ {
  4491.     python_string_end = regexp( $0 );
  4492.     string_face (true);
  4493.     language_print ($0);
  4494.     call (python_string);
  4495.     string_face (false);
  4496.   }
  4497.  
  4498.  
  4499.   /* Function */
  4500.   /([ \t]*)(def)([ \t]+)([^(]*)/ {
  4501.     /* indentation */
  4502.     language_print ($1);
  4503.  
  4504.     /* def */
  4505.     keyword_face (true);
  4506.     language_print ($2);
  4507.     keyword_face (false);
  4508.  
  4509.     /* middle */
  4510.     language_print ($3);
  4511.  
  4512.     /* Function name. */
  4513.     function_name_face (true);
  4514.     language_print ($4);
  4515.     function_name_face (false);
  4516.   }
  4517.  
  4518.     /* Keywords */
  4519. /\\b(a(nd|ssert)|break|c(lass|ontinue)|de(f|l)\\
  4520. |e(l(if|se(|:))|x(cept(|:)|ec))|f(inally:|or|rom)|global\\
  4521. |i(f|mport|n|s)|lambda|not|or|p(ass|rint)|r(aise|eturn)|try:|while)\\b/ {
  4522.   keyword_face (true);
  4523.   language_print ($0);
  4524.   keyword_face (false);
  4525. }
  4526.  
  4527.   LANGUAGE_SPECIALS {
  4528.     language_print ($0);
  4529.   }
  4530.  
  4531. }
  4532.  
  4533.  
  4534. /**
  4535.  * Name: scheme
  4536.  * Description: Scheme programming language.
  4537.  * Author: Markku Rossi <mtr@iki.fi>
  4538.  */
  4539.  
  4540. state scheme
  4541. {
  4542.   BEGIN {
  4543.     header ();
  4544.     if (need_version (1, 5, 2))
  4545.       {
  4546.     /*
  4547.      * Modify regexp character syntax so that we can distinguish all
  4548.      * scheme symbols.
  4549.      */
  4550.     extras = list ('!', '$', '%', '&', '*', '/', ':', '<',
  4551.                '=', '>', '?', '~', '^', '.', '+', '-');
  4552.     for (i = 0; i < length (extras); i = i + 1)
  4553.       regexp_syntax (extras[i], 'w');
  4554.       }
  4555.   }
  4556.   END {
  4557.     trailer ();
  4558.   }
  4559.  
  4560.   /* Comments. */
  4561.   /;/ {
  4562.     comment_face (true);
  4563.     language_print ($0);
  4564.     call (eat_one_line);
  4565.     comment_face (false);
  4566.   }
  4567.  
  4568.   /* String constants. */
  4569.   /\"/ {
  4570.     string_face (true);
  4571.     language_print ($0);
  4572.     call (c_string);
  4573.     string_face (false);
  4574.   }
  4575.  
  4576.   /* Definitions. */
  4577.   /(\([ \t]*)(define)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
  4578.     /* Starting garbage. */
  4579.     language_print ($1);
  4580.  
  4581.     /* Keyword `define'. */
  4582.     keyword_face (true);
  4583.     language_print ($2);
  4584.     keyword_face (false);
  4585.  
  4586.     /* Middle garbage. */
  4587.     language_print ($3);
  4588.  
  4589.     /* Function name. */
  4590.     function_name_face (true);
  4591.     language_print ($4);
  4592.     function_name_face (false);
  4593.   }
  4594.  
  4595.   /* ':'-names, Emacs highlights these, so do we. */
  4596.   /([ \t])(:[!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
  4597.     language_print ($1);
  4598.     reference_face (true);
  4599.     language_print ($2);
  4600.     reference_face (false);
  4601.   }
  4602.  
  4603.   /* Keywords.
  4604.      "=>" + "set!" +
  4605.      (build-re '(else define unquote unquote-splicing quote lambda
  4606.      if begin cond and or case let let* letrec do delay quasiquote))
  4607.    */
  4608.   /=>|\bset!|\b(and|begin|c(ase|ond)|d(e(fine|lay)|o)|else|if\
  4609. |l(ambda|et(|\*|rec))|or|qu(asiquote|ote)|unquote(|-splicing))\b/ {
  4610.     keyword_face (true);
  4611.     language_print ($0);
  4612.     keyword_face (false);
  4613.   }
  4614.  
  4615.   LANGUAGE_SPECIALS {
  4616.     language_print ($0);
  4617.   }
  4618. }
  4619.  
  4620.  
  4621. /**
  4622.  * Name: sh
  4623.  * Description: Bourne shell programming language.
  4624.  * Author: Juergen Kahrs <Juergen.Kahrs@t-online.de>
  4625.  */
  4626.  
  4627. state sh
  4628. {
  4629.   BEGIN {
  4630.     header ();
  4631.   }
  4632.   END {
  4633.     trailer ();
  4634.   }
  4635.  
  4636.   /* Comments. */
  4637.   /#/ {
  4638.     comment_face (true);
  4639.     language_print ($0);
  4640.     call (eat_one_line);
  4641.     comment_face (false);
  4642.   }
  4643.  
  4644.   /* String constants. */
  4645.   /\"/ {
  4646.     string_face (true);
  4647.     language_print ($0);
  4648.     call (c_string);
  4649.     string_face (false);
  4650.   }
  4651.  
  4652.   /* Excutable script. */
  4653.   /^#!/ {
  4654.     reference_face (true);
  4655.     language_print ($0);
  4656.     call (eat_one_line);
  4657.     reference_face (false);
  4658.   }
  4659.  
  4660.   /* Keywords. */
  4661.   /\b(CDPATH|HOME|IFS|MAIL((CHECK)?|(PATH)?)|P(ATH|S(1|2))|SH(ACCT|ELL)|\
  4662. break|c(ase|d|ontinue)|do(ne)?|e(cho|lse|sac|val|x(ec|it|port))|f(i|or)|\
  4663. getopts|hash|i[fn]|limit|newgrp|pwd|re(ad(only)?|turn)|s(et|hift)|\
  4664. t(est|hen|imes|rap|ype)|u(limit|mask|n(limit|set))|w(ait|hile))\b/ {
  4665.     keyword_face (true);
  4666.     language_print ($0);
  4667.     keyword_face (false);
  4668.   }
  4669.  
  4670.   LANGUAGE_SPECIALS {
  4671.     language_print ($0);
  4672.   }
  4673. }
  4674.  
  4675.  
  4676. /**
  4677.  * Name: sql
  4678.  * Description: Sybase 11 SQL.
  4679.  * Author: Chris Jack <chris_jack@msn.com>
  4680.  */
  4681.  
  4682. state sql_comment
  4683. {
  4684.   /\\\/\*/ {
  4685.     language_print ($0);
  4686.     call (sql_comment);
  4687.   }
  4688.   /\*\\\// {
  4689.     language_print ($0);
  4690.     return;
  4691.   }
  4692.   LANGUAGE_SPECIALS {
  4693.    language_print ($0);
  4694.   }
  4695. }
  4696.  
  4697. state sql_string
  4698. {
  4699.   /\\\\./ {
  4700.     language_print ($0);
  4701.   }
  4702.   /[\']/ {
  4703.     language_print ($0);
  4704.     return;
  4705.   }
  4706.   LANGUAGE_SPECIALS {
  4707.     language_print ($0);
  4708.   }
  4709. }
  4710.  
  4711. state sql
  4712. {
  4713.   BEGIN {
  4714.     header ();
  4715.   }
  4716.   END {
  4717.     trailer ();
  4718.   }
  4719.  
  4720.   /* Comments. */
  4721.   /\/\*/ {
  4722.     comment_face (true);
  4723.     language_print ($0);
  4724.     call (sql_comment);
  4725.     comment_face (false);
  4726.   }
  4727.  
  4728.   /* String constants. */
  4729.   /\"/ {
  4730.     string_face (true);
  4731.     language_print ($0);
  4732.     call (c_string);
  4733.     string_face (false);
  4734.   }
  4735.  
  4736.   /* Character constants. */
  4737.   /[\']/ {
  4738.     string_face (true);
  4739.     language_print ($0);
  4740.     call (sql_string);
  4741.     string_face (false);
  4742.   }
  4743.  
  4744.   /* Keywords.
  4745.    */
  4746.   /\b(\
  4747. [Aa][Bb][Ss]|\
  4748. [Aa][Cc][Oo][Ss]|\
  4749. [Aa][Dd][Dd]|\
  4750. [Aa][Ll][Ll]|\
  4751. [Aa][Ll][Ll][Oo][Ww]_[Dd][Uu][Pp]_[Rr][Oo][Ww]|\
  4752. [Aa][Ll][Tt][Ee][Rr]|\
  4753. [Aa][Nn][Dd]|\
  4754. [Aa][Nn][Ss][Ii][Nn][Uu][Ll][Ll]|\
  4755. [Aa][Nn][Ss][Ii]_[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn][Ss]|\
  4756. [Aa][Nn][Yy]|\
  4757. [Aa][Rr][Ii][Tt][Hh]_[Oo][Vv][Ee][Rr][Ff][Ll][Oo][Ww]|\
  4758. [Aa][Rr][Ii][Tt][Hh][Aa][Bb][Oo][Rr][Tt]|\
  4759. [Aa][Rr][Ii][Tt][Hh][Ii][Gg][Nn][Oo][Rr][Ee]|\
  4760. [Aa][Ss]|\
  4761. [Aa][Ss][Cc]|\
  4762. [Aa][Ss][Cc][Ii][Ii]|\
  4763. [Aa][Ss][Ii][Nn]|\
  4764. [Aa][Tt]|\
  4765. [Aa][Tt][Aa][Nn]|\
  4766. [Aa][Tt][Nn]2|\
  4767. [Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|\
  4768. [Aa][Uu][Tt][Oo]|\
  4769. [Aa][Vv][Gg]|\
  4770. [Bb][Ee][Gg][Ii][Nn]|\
  4771. [Bb][Ee][Tt][Ww][Ee][Ee][Nn]|\
  4772. [Bb][Ii][Nn][Aa][Rr][Yy]|\
  4773. [Bb][Rr][Ee][Aa][Kk]|\
  4774. [Bb][Rr][Oo][Ww][Ss][Ee]|\
  4775. [Bb][Uu][Ll][Kk]|\
  4776. [Bb][Uu][Ll][Kk][Cc][Oo][Pp][Yy]|\
  4777. [Bb][Yy]|\
  4778. [Cc][Aa][Ss][Cc][Aa][Dd][Ee]|\
  4779. [Cc][Ee][Ii][Ll][Ii][Nn][Gg]|\
  4780. [Cc][Hh][Aa][Ii][Nn][Ee][Dd]|\
  4781. [Cc][Hh][Aa][Rr]|\
  4782. [Cc][Hh][Aa][Rr]_[Cc][Oo][Nn][Vv][Ee][Rr][Tt]|\
  4783. [Cc][Hh][Aa][Rr]_[Ll][Ee][Nn][Gg][Tt][Hh]|\
  4784. [Cc][Hh][Aa][Rr][Aa][Cc][Tt][Ee][Rr]|\
  4785. [Cc][Hh][Aa][Rr][Ii][Nn][Dd][Ee][Xx]|\
  4786. [Cc][Hh][Ee][Cc][Kk]|\
  4787. [Cc][Hh][Ee][Cc][Kk][Pp][Oo][Ii][Nn][Tt]|\
  4788. [Cc][Ll][Oo][Ss][Ee]|\
  4789. [Cc][Ll][Uu][Ss][Tt][Ee][Rr][Ee][Dd]|\
  4790. [Cc][Oo][Ll]_[Ll][Ee][Nn][Gg][Tt][Hh]|\
  4791. [Cc][Oo][Ll]_[Nn][Aa][Mm][Ee]|\
  4792. [Cc][Oo][Mm][Mm][Ii][Tt]|\
  4793. [Cc][Oo][Mm][Pp][Uu][Tt][Ee]|\
  4794. [Cc][Oo][Nn][Ff][Ii][Rr][Mm]|\
  4795. [Cc][Oo][Nn][Ss][Tt][Rr][Aa][Ii][Nn][Tt]|\
  4796. [Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee]|\
  4797. [Cc][Oo][Nn][Tt][Rr][Oo][Ll][Rr][Oo][Ww]|\
  4798. [Cc][Oo][Nn][Vv][Ee][Rr][Tt]|\
  4799. [Cc][Oo][Ss]|\
  4800. [Cc][Oo][Tt]|\
  4801. [Cc][Oo][Uu][Nn][Tt]|\
  4802. [Cc][Rr][Ee][Aa][Tt][Ee]|\
  4803. [Cc][Uu][Rr][Rr][Ee][Nn][Tt]|\
  4804. [Cc][Uu][Rr][Ss][Oo][Rr]|\
  4805. [Cc][Uu][Rr][Uu][Nn][Rr][Ee][Ss][Ee][Rr][Vv][Ee][Dd][Pp][Gg][Ss]|\
  4806. [Dd][Aa][Tt][Aa]_[Pp][Gg][Ss]|\
  4807. [Dd][Aa][Tt][Aa][Bb][Aa][Ss][Ee]|\
  4808. [Dd][Aa][Tt][Aa][Ll][Ee][Nn][Gg][Tt][Hh]|\
  4809. [Dd][Aa][Tt][Ee][Aa][Dd][Dd]|\
  4810. [Dd][Aa][Tt][Ee][Dd][Ii][Ff][Ff]|\
  4811. [Dd][Aa][Tt][Ee][Ff][Ii][Rr][Ss][Tt]|\
  4812. [Dd][Aa][Tt][Ee][Ff][Oo][Rr][Mm][Aa][Tt]|\
  4813. [Dd][Aa][Tt][Ee][Nn][Aa][Mm][Ee]|\
  4814. [Dd][Aa][Tt][Ee][Pp][Aa][Rr][Tt]|\
  4815. [Dd][Aa][Tt][Ee][Tt][Ii][Mm][Ee]|\
  4816. [Dd][Bb]_[Ii][Dd]|\
  4817. [Dd][Bb]_[Nn][Aa][Mm][Ee]|\
  4818. [Dd][Bb][Cc][Cc]|\
  4819. [Dd][Ee][Aa][Ll][Ll][Oo][Cc][Aa][Tt][Ee]|\
  4820. [Dd][Ee][Cc][Ii][Mm][Aa][Ll]|\
  4821. [Dd][Ee][Cc][Ll][Aa][Rr][Ee]|\
  4822. [Dd][Ee][Ff][Aa][Uu][Ll][Tt]|\
  4823. [Dd][Ee][Ff][Ii][Nn][Ee]|\
  4824. [Dd][Ee][Gg][Rr][Ee][Ee][Ss]|\
  4825. [Dd][Ee][Ll][Ee][Tt][Ee]|\
  4826. [Dd][Ee][Ss][Cc]|\
  4827. [Dd][Ii][Ff][Ff][Ee][Rr][Ee][Nn][Cc][Ee]|\
  4828. [Dd][Ii][Ss][Kk]|\
  4829. [Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt]|\
  4830. [Dd][Oo][Uu][Bb][Ll][Ee]|\
  4831. [Dd][Rr][Oo][Pp]|\
  4832. [Dd][Uu][Mm][Mm][Yy]|\
  4833. [Dd][Uu][Mm][Pp]|\
  4834. [Ee][Ll][Ss][Ee]|\
  4835. [Ee][Nn][Dd]|\
  4836. [Ee][Nn][Dd][Tt][Rr][Aa][Nn]|\
  4837. [Ee][Rr][Rr][Ll][Vv][Ll]|\
  4838. [Ee][Rr][Rr][Oo][Rr]|\
  4839. [Ee][Rr][Rr][Oo][Rr][Dd][Aa][Tt][Aa]|\
  4840. [Ee][Rr][Rr][Oo][Rr][Ee][Xx][Ii][Tt]|\
  4841. [Ee][Ss][Cc][Aa][Pp][Ee]|\
  4842. [Ee][Xx][Cc][Ee][Pp][Tt]|\
  4843. [Ee][Xx][Ee][Cc][Uu][Tt][Ee]|\
  4844. [Ee][Xx][Ii][Ss][Tt][Ss]|\
  4845. [Ee][Xx][Ii][Tt]|\
  4846. [Ee][Xx][Pp]|\
  4847. [Ff][Ee][Tt][Cc][Hh]|\
  4848. [Ff][Ii][Ll][Ll][Ff][Aa][Cc][Tt][Oo][Rr]|\
  4849. [Ff][Ii][Pp][Ss][Ff][Ll][Aa][Gg][Gg][Ee][Rr]|\
  4850. [Ff][Ll][Oo][Aa][Tt]|\
  4851. [Ff][Ll][Oo][Oo][Rr]|\
  4852. [Ff][Ll][Uu][Ss][Hh][Mm][Ee][Ss][Ss][Aa][Gg][Ee]|\
  4853. [Ff][Oo][Rr]|\
  4854. [Ff][Oo][Rr][Ee][Ii][Gg][Nn]|\
  4855. [Ff][Rr][Oo][Mm]|\
  4856. [Gg][Ee][Tt][Dd][Aa][Tt][Ee]|\
  4857. [Gg][Oo][Tt][Oo]|\
  4858. [Gg][Rr][Aa][Nn][Tt]|\
  4859. [Gg][Rr][Oo][Uu][Pp]|\
  4860. [Hh][Aa][Vv][Ii][Nn][Gg]|\
  4861. [Hh][Ee][Xx][Tt][Oo][Ii][Nn][Tt]|\
  4862. [Hh][Oo][Ll][Dd][Ll][Oo][Cc][Kk]|\
  4863. [Hh][Oo][Ss][Tt]_[Nn][Aa][Mm][Ee]|\
  4864. [Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]|\
  4865. [Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]_[Ii][Nn][Ss][Ee][Rr][Tt]|\
  4866. [Ii][Ff]|\
  4867. [Ii][Gg][Nn][Oo][Rr][Ee]_[Dd][Uu][Pp]_[Kk][Ee][Yy]|\
  4868. [Ii][Gg][Nn][Oo][Rr][Ee]_[Dd][Uu][Pp]_[Rr][Oo][Ww]|\
  4869. [Ii][Mm][Aa][Gg][Ee]|\
  4870. [Ii][Nn]|\
  4871. [Ii][Nn][Dd][Ee][Xx]|\
  4872. [Ii][Nn][Dd][Ee][Xx]_[Cc][Oo][Ll]|\
  4873. [Ii][Nn][Ss][Ee][Rr][Tt]|\
  4874. [Ii][Nn][Tt]|\
  4875. [Ii][Nn][Tt][Ee][Gg][Ee][Rr]|\
  4876. [Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt]|\
  4877. [Ii][Nn][Tt][Oo]|\
  4878. [Ii][Nn][Tt][Tt][Oo][Hh][Ee][Xx]|\
  4879. [Ii][Oo]|\
  4880. [Ii][Ss]|\
  4881. [Ii][Ss][Nn][Uu][Ll][Ll]|\
  4882. [Ii][Ss][Oo][Ll][Aa][Tt][Ii][Oo][Nn]|\
  4883. [Kk][Ee][Yy]|\
  4884. [Kk][Ii][Ll][Ll]|\
  4885. [Ll][Aa][Nn][Gg][Uu][Aa][Gg][Ee]|\
  4886. [Ll][Cc][Tt]_[Aa][Dd][Mm][Ii][Nn]|\
  4887. [Ll][Ee][Vv][Ee][Ll]|\
  4888. [Ll][Ii][Kk][Ee]|\
  4889. [Ll][Ii][Nn][Ee][Nn][Oo]|\
  4890. [Ll][Oo][Aa][Dd]|\
  4891. [Ll][Oo][Gg]|\
  4892. [Ll][Oo][Gg]10|\
  4893. [Ll][Oo][Ww][Ee][Rr]|\
  4894. [Ll][Rr][Uu]|\
  4895. [Ll][Tt][Rr][Ii][Mm]|\
  4896. [Mm][Aa][Xx]|\
  4897. [Mm][Ii][Nn]|\
  4898. [Mm][Ii][Rr][Rr][Oo][Rr]|\
  4899. [Mm][Ii][Rr][Rr][Oo][Rr][Ee][Xx][Ii][Tt]|\
  4900. [Mm][Oo][Nn][Ee][Yy]|\
  4901. [Mm][Rr][Uu]|\
  4902. [Nn][Aa][Tt][Ii][Oo][Nn][Aa][Ll]|\
  4903. [Nn][Cc][Hh][Aa][Rr]|\
  4904. [Nn][Oo]_[Ee][Rr][Rr][Oo][Rr]|\
  4905. [Nn][Oo][Cc][Oo][Uu][Nn][Tt]|\
  4906. [Nn][Oo][Ee][Xx][Ee][Cc]|\
  4907. [Nn][Oo][Hh][Oo][Ll][Dd][Ll][Oo][Cc][Kk]|\
  4908. [Nn][Oo][Nn][Cc][Ll][Uu][Ss][Tt][Ee][Rr][Ee][Dd]|\
  4909. [Nn][Oo][Tt]|\
  4910. [Nn][Uu][Ll][Ll]|\
  4911. [Nn][Uu][Mm][Ee][Rr][Ii][Cc]|\
  4912. [Nn][Uu][Mm][Ee][Rr][Ii][Cc]_[Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ii][Oo][Nn]|\
  4913. [Nn][Vv][Aa][Rr][Cc][Hh][Aa][Rr]|\
  4914. [Oo][Bb][Jj][Ee][Cc][Tt]_[Ii][Dd]|\
  4915. [Oo][Bb][Jj][Ee][Cc][Tt]_[Nn][Aa][Mm][Ee]|\
  4916. [Oo][Ff]|\
  4917. [Oo][Ff][Ff]|\
  4918. [Oo][Ff][Ff][Ss][Ee][Tt][Ss]|\
  4919. [Oo][Nn]|\
  4920. [Oo][Nn][Cc][Ee]|\
  4921. [Oo][Nn][Ll][Yy]|\
  4922. [Oo][Pp][Ee][Nn]|\
  4923. [Oo][Pp][Tt][Ii][Oo][Nn]|\
  4924. [Oo][Rr]|\
  4925. [Oo][Rr][Dd][Ee][Rr]|\
  4926. [Oo][Vv][Ee][Rr]|\
  4927. [Pp][Aa][Rr][Aa][Mm]|\
  4928. [Pp][Aa][Rr][Ss][Ee][Oo][Nn][Ll][Yy]|\
  4929. [Pp][Aa][Tt][Ii][Nn][Dd][Ee][Xx]|\
  4930. [Pp][Ee][Rr][Mm][Aa][Nn][Ee][Nn][Tt]|\
  4931. [Pp][Ii]|\
  4932. [Pp][Ll][Aa][Nn]|\
  4933. [Pp][Oo][Ww][Ee][Rr]|\
  4934. [Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn]|\
  4935. [Pp][Rr][Ee][Ff][Ee][Tt][Cc][Hh]|\
  4936. [Pp][Rr][Ee][Pp][Aa][Rr][Ee]|\
  4937. [Pp][Rr][Ii][Mm][Aa][Rr][Yy]|\
  4938. [Pp][Rr][Ii][Nn][Tt]|\
  4939. [Pp][Rr][Ii][Vv][Ii][Ll][Ee][Gg][Ee][Ss]|\
  4940. [Pp][Rr][Oo][Cc]|\
  4941. [Pp][Rr][Oo][Cc][Ii][Dd]|\
  4942. [Pp][Rr][Oo][Cc]_[Rr][Oo][Ll][Ee]|\
  4943. [Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]|\
  4944. [Pp][Rr][Oo][Cc][Ee][Ss][Ss][Ee][Xx][Ii][Tt]|\
  4945. [Pp][Uu][Bb][Ll][Ii][Cc]|\
  4946. [Qq][Uu][Oo][Tt][Ee][Dd]_[Ii][Dd][Ee][Nn][Tt][Ii][Ff][Ii][Ee][Rr]|\
  4947. [Rr][Aa][Dd][Ii][Aa][Nn][Ss]|\
  4948. [Rr][Aa][Ii][Ss][Ee][Rr][Rr][Oo][Rr]|\
  4949. [Rr][Aa][Nn][Dd]|\
  4950. [Rr][Ee][Aa][Dd]|\
  4951. [Rr][Ee][Aa][Dd][Tt][Ee][Xx][Tt]|\
  4952. [Rr][Ee][Aa][Ll]|\
  4953. [Rr][Ee][Cc][Oo][Nn][Ff][Ii][Gg][Uu][Rr][Ee]|\
  4954. [Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss]|\
  4955. [Rr][Ee][Pp][Ll][Aa][Cc][Ee]|\
  4956. [Rr][Ee][Pp][Ll][Ii][Cc][Aa][Tt][Ee]|\
  4957. [Rr][Ee][Ss][Ee][Rr][Vv][Ee][Dd]_[Pp][Gg][Ss]|\
  4958. [Rr][Ee][Ss][Tt][Rr][Ee][Ee]|\
  4959. [Rr][Ee][Tt][Uu][Rr][Nn]|\
  4960. [Rr][Ee][Vv][Ee][Rr][Ss][Ee]|\
  4961. [Rr][Ee][Vv][Oo][Kk][Ee]|\
  4962. [Rr][Ii][Gg][Hh][Tt]|\
  4963. [Rr][Oo][Ll][Ee]|\
  4964. [Rr][Oo][Ll][Ll][Bb][Aa][Cc][Kk]|\
  4965. [Rr][Oo][Uu][Nn][Dd]|\
  4966. [Rr][Oo][Ww][Cc][Nn][Tt]|\
  4967. [Rr][Oo][Ww][Cc][Oo][Uu][Nn][Tt]|\
  4968. [Rr][Oo][Ww][Ss]|\
  4969. [Rr][Tt][Rr][Ii][Mm]|\
  4970. [Rr][Uu][Ll][Ee]|\
  4971. [Ss][Aa][Vv][Ee]|\
  4972. [Ss][Cc][Hh][Ee][Mm][Aa]|\
  4973. [Ss][Ee][Ll][Ee][Cc][Tt]|\
  4974. [Ss][Ee][Ll][Ff]_[Rr][Ee][Cc][Uu][Rr][Ss][Ii][Oo][Nn]|\
  4975. [Ss][Ee][Tt]|\
  4976. [Ss][Ee][Tt][Uu][Ss][Ee][Rr]|\
  4977. [Ss][Hh][Aa][Rr][Ee][Dd]|\
  4978. [Ss][Hh][Oo][Ww]_[Rr][Oo][Ll][Ee]|\
  4979. [Ss][Hh][Oo][Ww][Pp][Ll][Aa][Nn]|\
  4980. [Ss][Hh][Uu][Tt][Dd][Oo][Ww][Nn]|\
  4981. [Ss][Ii][Gg][Nn]|\
  4982. [Ss][Ii][Nn]|\
  4983. [Ss][Mm][Aa][Ll][Ll][Dd][Aa][Tt][Ee][Tt][Ii][Mm][Ee]|\
  4984. [Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt]|\
  4985. [Ss][Mm][Aa][Ll][Ll][Mm][Oo][Nn][Ee][Yy]|\
  4986. [Ss][Oo][Uu][Nn][Dd][Ee][Xx]|\
  4987. [Ss][Pp][Aa][Cc][Ee]|\
  4988. [Ss][Qq][Rr][Tt]|\
  4989. [Ss][Tt][Aa][Tt][Ee][Mm][Ee][Nn][Tt]|\
  4990. [Ss][Tt][Aa][Tt][Ii][Ss][Tt][Ii][Cc][Ss]|\
  4991. [Ss][Tt][Rr]|\
  4992. [Ss][Tt][Rr][Ii][Nn][Gg]_[Rr][Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ii][Oo][Nn]|\
  4993. [Ss][Tt][Rr][Ii][Pp][Ee]|\
  4994. [Ss][Tt][Uu][Ff][Ff]|\
  4995. [Ss][Uu][Bb][Qq][Uu][Ee][Rr][Yy][Cc][Aa][Cc][Hh][Ee]|\
  4996. [Ss][Uu][Bb][Ss][Tt][Rr][Ii][Nn][Gg]|\
  4997. [Ss][Uu][Mm]|\
  4998. [Ss][Uu][Ss][Ee][Rr]_[Ii][Dd]|\
  4999. [Ss][Uu][Ss][Ee][Rr]_[Nn][Aa][Mm][Ee]|\
  5000. [Ss][Yy][Bb]_[Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]|\
  5001. [Tt][Aa][Bb][Ll][Ee]|\
  5002. [Tt][Aa][Nn]|\
  5003. [Tt][Ee][Mm][Pp][Oo][Rr][Aa][Rr][Yy]|\
  5004. [Tt][Ee][Rr][Mm][Ii][Nn][Aa][Tt][Ee]|\
  5005. [Tt][Ee][Xx][Tt]|\
  5006. [Tt][Ee][Xx][Tt][Ss][Ii][Zz][Ee]|\
  5007. [Tt][Ii][Mm][Ee]|\
  5008. [Tt][Ii][Nn][Yy][Ii][Nn][Tt]|\
  5009. [Tt][Oo]|\
  5010. [Tt][Rr][Aa][Nn][Ss][Aa][Cc][Tt][Ii][Oo][Nn]|\
  5011. [Tt][Rr][Ii][Gg][Gg][Ee][Rr]|\
  5012. [Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ee]|\
  5013. [Tt][Ss][Ee][Qq][Uu][Aa][Ll]|\
  5014. [Uu][Nn][Ii][Oo][Nn]|\
  5015. [Uu][Nn][Ii][Qq][Uu][Ee]|\
  5016. [Uu][Pp][Dd][Aa][Tt][Ee]|\
  5017. [Uu][Pp][Pp][Ee][Rr]|\
  5018. [Uu][Ss][Ee]|\
  5019. [Uu][Ss][Ee][Dd]_[Pp][Gg][Ss]|\
  5020. [Uu][Ss][Ee][Rr]|\
  5021. [Uu][Ss][Ee][Rr]_[Ii][Dd]|\
  5022. [Uu][Ss][Ee][Rr]_[Nn][Aa][Mm][Ee]|\
  5023. [Uu][Ss][Ee][Rr]_[Oo][Pp][Tt][Ii][Oo][Nn]|\
  5024. [Uu][Ss][Ii][Nn][Gg]|\
  5025. [Vv][Aa][Ll][Ii][Dd]_[Nn][Aa][Mm][Ee]|\
  5026. [Vv][Aa][Ll][Ii][Dd]_[Uu][Ss][Ee][Rr]|\
  5027. [Vv][Aa][Ll][Uu][Ee][Ss]|\
  5028. [Vv][Aa][Rr][Bb][Ii][Nn][Aa][Rr][Yy]|\
  5029. [Vv][Aa][Rr][Cc][Hh][Aa][Rr]|\
  5030. [Vv][Aa][Rr][Yy][Ii][Nn][Gg]|\
  5031. [Vv][Ii][Ee][Ww]|\
  5032. [Ww][Aa][Ii][Tt][Ff][Oo][Rr]|\
  5033. [Ww][Hh][Ee][Rr][Ee]|\
  5034. [Ww][Hh][Ii][Ll][Ee]|\
  5035. [Ww][Ii][Tt][Hh]|\
  5036. [Ww][Oo][Rr][Kk]|\
  5037. [Ww][Rr][Ii][Tt][Ee][Tt][Ee][Xx][Tt]\
  5038. )\b/ {
  5039.     keyword_face (true);
  5040.     language_print ($0);
  5041.     keyword_face (false);
  5042.   }
  5043.  
  5044.   LANGUAGE_SPECIALS {
  5045.     language_print ($0);
  5046.   }
  5047. }
  5048.  
  5049.  
  5050.  
  5051. /**
  5052.  * Name: states
  5053.  * Description: States program's definition files.
  5054.  * Author: Markku Rossi <mtr@iki.fi>
  5055.  */
  5056.  
  5057. state states_regexp
  5058. {
  5059.   /\\\\./ {
  5060.     language_print ($0);
  5061.   }
  5062.   /\// {
  5063.     language_print ($0);
  5064.     return;
  5065.   }
  5066.   LANGUAGE_SPECIALS {
  5067.     language_print ($0);
  5068.   }
  5069. }
  5070.  
  5071. state states
  5072. {
  5073.   BEGIN {
  5074.     header ();
  5075.   }
  5076.   END {
  5077.     trailer ();
  5078.   }
  5079.  
  5080.   /* Comments. */
  5081.   /\/\*/ {
  5082.     comment_face (true);
  5083.     language_print ($0);
  5084.     call (c_comment);
  5085.     comment_face (false);
  5086.   }
  5087.  
  5088.   /* String constants. */
  5089.   /\"/ {
  5090.     string_face (true);
  5091.     language_print ($0);
  5092.     call (c_string);
  5093.     string_face (false);
  5094.   }
  5095.  
  5096.   /* Regular expressions. */
  5097.   /\\\// {
  5098.     string_face (true);
  5099.     language_print ($0);
  5100.     call (states_regexp);
  5101.     string_face (false);
  5102.   }
  5103.  
  5104.   /* Subroutine definitions. */
  5105.   /\b(sub)([ \t]+)([$a-zA-Z_][$a-zA-Z_0-9]*)([ \t]*\()/ {
  5106.     keyword_face (true);
  5107.     language_print ($1);
  5108.     keyword_face (false);
  5109.  
  5110.     language_print ($2);
  5111.  
  5112.     function_name_face (true);
  5113.     language_print ($3);
  5114.     function_name_face (false);
  5115.  
  5116.     language_print ($4);
  5117.   }
  5118.  
  5119.   /* Keywords.
  5120.      (build-re '(BEGIN END div else for if local namerules return start
  5121.      startrules state sub while))
  5122.    */
  5123.   /\b(BEGIN|END|div|else|for|if|local|namerules|return\
  5124. |s(ta(rt(|rules)|te)|ub)|while)\b/ {
  5125.     keyword_face (true);
  5126.     language_print ($0);
  5127.     keyword_face (false);
  5128.   }
  5129.  
  5130.   /* Build-ins:
  5131.      (build-re '(call check_namerules check_startrules concat getenv int
  5132.      length list panic prereq print regmatch regsub regsuball sprintf
  5133.      strcmp string strncmp substring))
  5134.    */
  5135.   /\b(c(all|heck_(namerules|startrules)|oncat)|getenv|int|l(ength|ist)\
  5136. |p(anic|r(ereq|int))|reg(match|sub(|all))\
  5137. |s(printf|tr(cmp|ing|ncmp)|ubstring))([ \t]*\()/ {
  5138.     builtin_face (true);
  5139.     language_print ($1);
  5140.     builtin_face (false);
  5141.     language_print (substring ($0, length ($1), length ($0)));
  5142.   }
  5143.  
  5144.   LANGUAGE_SPECIALS {
  5145.     language_print ($0);
  5146.   }
  5147. }
  5148.  
  5149.  
  5150. /**
  5151.  * Name: synopsys
  5152.  * Description: Synopsys dc shell scripting language
  5153.  *
  5154.  * Author: Brian Silveira  (brian@nortel.ca)
  5155.  *       Hartley Horwitz (hars@nortel.ca)
  5156.  */
  5157. state synopsys
  5158. {
  5159.   BEGIN {
  5160.     header ();
  5161.   }
  5162.   END {
  5163.     trailer ();
  5164.   }
  5165.  
  5166.   /*
  5167.    * Synopsys allows globing...so pick out constructs like
  5168.    * /foo/bar/* and just print them out.  i.e. don't treat the
  5169.    * ending like a comment!
  5170.    */
  5171.   /[A-z0-9_-]\/\*/{
  5172.     language_print($0);
  5173.   }
  5174.  
  5175.  
  5176.   /* Comments.
  5177.    * Synopsys DC-shell uses C-style comments
  5178.    */
  5179.   /\/\*/ {
  5180.     comment_face (true);
  5181.     language_print ($0);
  5182.     call (c_comment);
  5183.     comment_face (false);
  5184.   }
  5185.  
  5186.   /* String constants. */
  5187.   /\"/ {
  5188.     string_face (true);
  5189.     language_print ($0);
  5190.     call (c_string);
  5191.     string_face (false);
  5192.   }
  5193.  
  5194.   /* I use make-regexp in emacs which uses a list of strings to
  5195.      generate a     regular expression.
  5196.      (setq synopsys-keywords-enscript
  5197.       '("alias" "all_connected" "analyze" "balance_buffer"
  5198.     "balance_registers" "break" "cd" "change_link" "change_names"
  5199.     "characterize" "check_design" "check_test" "check_timing"
  5200.     "continue" "compile" "copy_design" "create_clock" "drive_of"
  5201.     "echo" "elaborate" "else" "exit" "get_attribute" "get_license"
  5202.     "get_unix_variable" "group" "group_path" "include"
  5203.     "insert_scan" "insert_test" "link" "list_designs"
  5204.     "list_instances" "list_libs" "load_of" "quit" "read"
  5205.     "read_lib" "read_timing" "remove_attribute"
  5206.     "remove_constraint" "remove_design" "remove_input_delay"
  5207.     "remove_lib" "remove_clock" "remove_cell" "remove_license"
  5208.     "remove_output_delay" "remove_unconnected_ports"
  5209.     "rename_design" "reoptimize_design" "report_area"
  5210.     "report_attribute" "report_cell" "report_constraint"
  5211.     "report_design" "report_design_lib" "report_hierarchy"
  5212.     "report_internal_loads" "report_lib" "report_multicycles"
  5213.     "report_net" "report_port" "report_power" "report_reference"
  5214.     "report_resources" "report_test" "report_timing"
  5215.     "reset_design" "set_attribute" "set_boundary_optimization"
  5216.     "set_clock_skew" "set_dont_touch" "set_dont_touch_network"
  5217.     "set_dont_use" "set_drive" "set_driving_cell" "set_equal"
  5218.     "set_disable_timing" "set_false_path" "set_flatten"
  5219.     "set_implementation" "set_fix_hold" "set_input_delay"
  5220.     "set_load" "set_logic_one" "set_logic_zero" "set_max_area"
  5221.     "set_max_capacitance" "set_max_fanout" "set_max_transition"
  5222.     "set_multicycle_path" "set_operating_conditions"
  5223.     "set_output_delay" "set_scan_style" "set_signal_type"
  5224.     "set_structure" "set_test_methodology" "set_unconnected"
  5225.     "set_wire_load" "unalias" "sh" "ungroup" "uniquify"
  5226.     "update_lib" "which" "write" "write_constraints"
  5227.     "write_script" "write_timing" "if" "foreach" "find" "while"
  5228.     "-all" "-all_violators" "-allowed" "-attributes" "-base_name"
  5229.     "-boundary_optimization" "-cell" "-cell_name" "-clock"
  5230.     "-context" "-connections" "-constraints" "-delay" "-design"
  5231.     "-design_name" "-depth" "-drive" "-except" "-f" "-fall_delay"
  5232.     "-flat" "-format" "-from" "-hierarchy" "-hier" "-hold"
  5233.     "-incremental_mapping" "-ideal" "-ignored" "-in_place"
  5234.     "-logic" "-library" "-map_effort" "-mode" "-max_paths"
  5235.     "-max_scan_chain_length" "-no_disable" "-methodology" "-name"
  5236.     "-net" "-new_name" "-none" "-nosplit" "-nworst" "-output"
  5237.     "-path" "-parameters" "-period" "-pin_load" "-propagated"
  5238.     "-reference" "-rise_delay" "-rules" "-skew" "-setup"
  5239.     "-through" "-to" "-type" "-uncertainty" "-plus_uncertainty"
  5240.     "-minus_uncertainty" "-update" "-verify" "-verbose"
  5241.     "-waveform" "-wire_load" "-work" "-weight" "-worst"
  5242.     "actel_qbar_opto" "actel_seq_opto" "auto_link_disable"
  5243.     "auto_link_options" "auto_wire_load_selection"
  5244.     "bc_enable_chaining" "bc_enable_multi_cycle"
  5245.     "bc_enable_speculative_execution" "bc_fsm_coding_style"
  5246.     "bc_time_all_sequential_op_bindings" "bus_extraction_style"
  5247.     "bus_inference_style" "bus_naming_style"
  5248.     "change_names_dont_change_bus_members"
  5249.     "change_names_update_inst_tree" "command_log_file" "company"
  5250.     "compatibility_version"
  5251.     "compile_assume_fully_decoded_three_state_busses"
  5252.     "compile_create_mux_op_hierarchy"
  5253.     "compile_default_critical_range"
  5254.     "compile_disable_area_opt_during_inplace_opt"
  5255.     "compile_disable_hierarchical_inverter_opt"
  5256.     "compile_dont_touch_annotated_cell_during_inplace_opt"
  5257.     "compile_fix_multiple_port_nets"
  5258.     "compile_ignore_area_during_inplace_opt"
  5259.     "compile_ignore_footprint_during_inplace_opt"
  5260.     "compile_implementation_selection"
  5261.     "compile_inplace_changed_list_file_name"
  5262.     "compile_instance_name_prefix" "compile_instance_name_suffix"
  5263.     "compile_mux_no_boundary_optimization"
  5264.     "compile_negative_logic_methodology"
  5265.     "compile_no_new_cells_at_top_level"
  5266.     "compile_ok_to_buffer_during_inplace_opt"
  5267.     "compile_preserve_subdesign_interfaces"
  5268.     "compile_preserve_sync_resets"
  5269.     "compile_update_annotated_delays_during_inplace_opt"
  5270.     "compile_use_fast_delay_mode" "compile_use_low_timing_effort"
  5271.     "context_check_status" "current_design" "current_instance"
  5272.     "dc_shell_status" "default_name_rules" "design_library_file"
  5273.     "designer" "duplicate_ports" "echo_include_commands"
  5274.     "enable_page_mode" "exit_delete_filename_log_file"
  5275.     "filename_log_file" "find_converts_name_lists"
  5276.     "find_ignore_case" "hdl_keep_licenses" "hdl_naming_threshold"
  5277.     "hdl_preferred_license" "hdl_variables"
  5278.     "hdlin_advisor_directory" "hdlin_auto_save_templates"
  5279.     "hdlin_check_no_latch"
  5280.     "hdlin_dont_infer_mux_for_resource_sharing"
  5281.     "hdlin_enable_advisor" "hdlin_ff_always_async_set_reset"
  5282.     "hdlin_ff_always_sync_set_reset" "hdlin_files"
  5283.     "hdlin_hide_resource_line_numbers" "hdlin_infer_mux"
  5284.     "hdlin_keep_feedback" "hdlin_keep_inv_feedback"
  5285.     "hdlin_mux_size_limit" "hdlin_reg_report_length"
  5286.     "hdlin_replace_synthetic" "hdlin_report_inferred_modules"
  5287.     "hdlin_resource_allocation" "hdlin_resource_implementation"
  5288.     "hdlin_source_to_gates_mode" "hdlin_sync_set_reset"
  5289.     "hdlin_synch_set_reset" "hdlin_translate_off_skip_text"
  5290.     "link_force_case" "link_library"
  5291.     "port_complement_naming_style"
  5292.     "reoptimize_design_changed_list_file_name"
  5293.     "sdfin_fall_cell_delay_type" "sdfin_fall_net_delay_type"
  5294.     "sdfin_min_fall_cell_delay" "sdfin_min_fall_net_delay"
  5295.     "sdfin_min_rise_cell_delay" "sdfin_min_rise_net_delay"
  5296.     "sdfin_rise_cell_delay_type" "sdfin_rise_net_delay_type"
  5297.     "sdfin_top_instance_name"
  5298.     "sdfout_allow_non_positive_constraints"
  5299.     "sdfout_min_fall_cell_delay" "sdfout_min_fall_net_delay"
  5300.     "sdfout_min_rise_cell_delay" "sdfout_min_rise_net_delay"
  5301.     "sdfout_time_scale" "sdfout_top_instance_name"
  5302.     "sdfout_write_to_output" "search_path" "shell_prompt"
  5303.     "suppress_errors" "synlib_dont_get_license"
  5304.     "syntax_check_status" "synthetic_library" "target_library"
  5305.     "uniquify_naming_style" "verbose_messages"))
  5306.     */
  5307.  
  5308.   /\ba(l(ias|l_connected)|nalyze|uto_(link_(disable|options)\
  5309. |wire_load_selection))|b(alance_(buffer|registers)\
  5310. |c_(enable_(chaining|multi_cycle|speculative_execution)\
  5311. |fsm_coding_style|time_all_sequential_op_bindings)|reak\
  5312. |us_(extraction_style|inference_style|naming_style))\
  5313. |c(d|h(a(nge_(link|names(|_(dont_change_bus_members|update_inst_tree)))\
  5314. |racterize)|eck_(design|t(est|iming)))|o(m(mand_log_file|p(a(ny\
  5315. |tibility_version)|ile(|_(assume_fully_decoded_three_state_busses\
  5316. |create_mux_op_hierarchy|d(efault_critical_range\
  5317. |isable_(area_opt_during_inplace_opt|hierarchical_inverter_opt)\
  5318. |ont_touch_annotated_cell_during_inplace_opt)|fix_multiple_port_nets\
  5319. |i(gnore_(area_during_inplace_opt|footprint_during_inplace_opt)\
  5320. |mplementation_selection|n(place_changed_list_file_name\
  5321. |stance_name_(prefix|suffix)))|mux_no_boundary_optimization\
  5322. |n(egative_logic_methodology|o_new_cells_at_top_level)\
  5323. |ok_to_buffer_during_inplace_opt|preserve_s(ubdesign_interfaces\
  5324. |ync_resets)|u(pdate_annotated_delays_during_inplace_opt\
  5325. |se_(fast_delay_mode|low_timing_effort))))))|nt(ext_check_status|inue)\
  5326. |py_design)|reate_clock|urrent_(design|instance))|d(c_shell_status\
  5327. |e(fault_name_rules|sign(_library_file|er))|rive_of|uplicate_ports)|e(cho(\
  5328. |_include_commands)|l(aborate|se)|nable_page_mode|xit(\
  5329. |_delete_filename_log_file))|f(i(lename_log_file|nd(|_(converts_name_lists\
  5330. |ignore_case)))|oreach)|g(et_(attribute|license|unix_variable)|roup(\
  5331. |_path))|hdl(_(keep_licenses|naming_threshold|preferred_license|variables)\
  5332. |in_(a(dvisor_directory|uto_save_templates)|check_no_latch\
  5333. |dont_infer_mux_for_resource_sharing|enable_advisor\
  5334. |f(f_always_(async_set_reset|sync_set_reset)|iles)\
  5335. |hide_resource_line_numbers|infer_mux|keep_(feedback|inv_feedback)\
  5336. |mux_size_limit|re(g_report_length|p(lace_synthetic|ort_inferred_modules)\
  5337. |source_(allocation|implementation))|s(ource_to_gates_mode|ync(_set_reset\
  5338. |h_set_reset))|translate_off_skip_text))|i(f|n(clude|sert_(scan|test)))\
  5339. |l(i(nk(|_(force_case|library))|st_(designs|instances|libs))|oad_of)\
  5340. |port_complement_naming_style|quit|re(ad(|_(lib|timing))|move_(attribute\
  5341. |c(ell|lock|onstraint)|design|input_delay|li(b|cense)|output_delay\
  5342. |unconnected_ports)|name_design|optimize_design(|_changed_list_file_name)\
  5343. |port_(a(rea|ttribute)|c(ell|onstraint)|design(|_lib)|hierarchy\
  5344. |internal_loads|lib|multicycles|net|po(rt|wer)|re(ference|sources)|t(est\
  5345. |iming))|set_design)|s(df(in_(fall_(cell_delay_type|net_delay_type)\
  5346. |min_(fall_(cell_delay|net_delay)|rise_(cell_delay|net_delay))\
  5347. |rise_(cell_delay_type|net_delay_type)|top_instance_name)\
  5348. |out_(allow_non_positive_constraints|min_(fall_(cell_delay|net_delay)\
  5349. |rise_(cell_delay|net_delay))|t(ime_scale|op_instance_name)\
  5350. |write_to_output))|e(arch_path|t_(attribute|boundary_optimization\
  5351. |clock_skew|d(isable_timing|ont_(touch(|_network)|use)|riv(e|ing_cell))\
  5352. |equal|f(alse_path|ix_hold|latten)|i(mplementation|nput_delay)|lo(ad\
  5353. |gic_(one|zero))|m(ax_(area|capacitance|fanout|transition)|ulticycle_path)\
  5354. |o(perating_conditions|utput_delay)|s(can_style|ignal_type|tructure)\
  5355. |test_methodology|unconnected|wire_load))|h(|ell_prompt)|uppress_errors\
  5356. |yn(lib_dont_get_license|t(ax_check_status|hetic_library)))|target_library\
  5357. |u(n(alias|group|iquify(|_naming_style))|pdate_lib)|verbose_messages\
  5358. |w(hi(ch|le)|rite(|_(constraints|script|timing)))\b/{
  5359.     keyword_face (true);
  5360.     language_print ($0);
  5361.     keyword_face (false);
  5362.   }
  5363.  
  5364.   LANGUAGE_SPECIALS {
  5365.     language_print ($0);
  5366.   }
  5367.  
  5368. }
  5369.  
  5370.  
  5371. /**
  5372.  * Name: tcl
  5373.  * Description: Tcl programming language.
  5374.  * Author: Markku Rossi <mtr@iki.fi>
  5375.  */
  5376.  
  5377. state tcl_comment
  5378. {
  5379.   /[^\\\\]\n/ {
  5380.     language_print ($0);
  5381.     return;
  5382.   }
  5383.   LANGUAGE_SPECIALS {
  5384.     language_print ($0);
  5385.   }
  5386. }
  5387.  
  5388. state tcl_proc_arglist
  5389. {
  5390.   /* List of arguments. */
  5391.   /{/ {
  5392.     language_print ($0);
  5393.     variable_name_face (true);
  5394.     str = match_balanced_block (/{/, /}/);
  5395.     variable_name_face (false);
  5396.     language_print (str);
  5397.     return;
  5398.   }
  5399.   /* Only one argument. */
  5400.   /[A-Za-z0-9]+/ {
  5401.     variable_name_face (true);
  5402.     language_print ($0);
  5403.     variable_name_face (false);
  5404.     return;
  5405.   }
  5406.   /* No idea what this is??? */
  5407.   /[.\n]/ {
  5408.     language_print ($0);
  5409.     return;
  5410.   }
  5411. }
  5412.  
  5413. state tcl
  5414. {
  5415.   BEGIN {
  5416.     header ();
  5417.   }
  5418.   END {
  5419.     trailer ();
  5420.   }
  5421.  
  5422.   /* Comments. */
  5423.   /#/ {
  5424.     comment_face (true);
  5425.     language_print ($0);
  5426.     call (tcl_comment);
  5427.     comment_face (false);
  5428.   }
  5429.   /#\n/ {
  5430.     comment_face (true);
  5431.     language_print ($0);
  5432.     comment_face (false);
  5433.   }
  5434.  
  5435.   /* String constants. */
  5436.   /\"/ {
  5437.     string_face (true);
  5438.     language_print ($0);
  5439.     call (c_string);
  5440.     string_face (false);
  5441.   }
  5442.  
  5443.   /* Procedure definitions. */
  5444.   /\b(proc)([ \t]+)([A-Za-z_0-9]+)([ \t]+)/ {
  5445.     /* Keyword `proc'. */
  5446.     keyword_face (true);
  5447.     language_print ($1);
  5448.     keyword_face (false);
  5449.  
  5450.     /* Middle garbage. */
  5451.     language_print ($2);
  5452.  
  5453.     /* Function name. */
  5454.     function_name_face (true);
  5455.     language_print ($3);
  5456.     function_name_face (false);
  5457.  
  5458.     /* Second middle garbage. */
  5459.     language_print ($4);
  5460.  
  5461.     /* Function argument list. */
  5462.     call (tcl_proc_arglist);
  5463.   }
  5464.  
  5465.   /* Simple variable reference. */
  5466.   /(\$)([A-Za-z_0-9]+)/ {
  5467.     language_print ($1);
  5468.     variable_name_face (true);
  5469.     language_print ($2);
  5470.     variable_name_face (false);
  5471.   }
  5472.  
  5473.   /* {}-enclosed variable reference. */
  5474.   /\${/ {
  5475.     language_print ($0);
  5476.     variable_name_face (true);
  5477.     str = match_balanced_block (/{/, /}/);
  5478.     variable_name_face (false);
  5479.     language_print (str);
  5480.   }
  5481.  
  5482.   /* Keywords.
  5483.      (build-re '(
  5484.      ;; Tcl:
  5485.      Http Tcl after append array bgerror break case catch cd clock
  5486.      concat continue eof error eval exec exit expr fblocked fconfigure file
  5487.      fileevent filename flush for foreach format gets glob global history
  5488.      if incr info interp join lappend library lindex linsert list llength
  5489.      load lose lrange lreplace lsearch lsort open package pid pkg_mkIndex
  5490.      proc puts pwd read regexp regsub rename return scan seek set socket
  5491.      source split string subst switch tclvars tell time trace unknown unset
  5492.      update uplevel upvar vwait while
  5493.  
  5494.      ;; Tk:
  5495.      bell bind bindtags bitmap button canvas checkbutton clipboard destroy
  5496.      entry event focus font frame grab grid image label listbox lower menu
  5497.      menubutton message option options pack photo place radiobutton raise
  5498.      scale scrollbar selection send text tk tk_bindForTraversal tk_bisque
  5499.      tk_chooseColor tk_dialog tk_focusFollowsMouse tk_focusNext
  5500.      tk_focusPrev tk_getOpenFile tk_getSaveFile tk_menuBar tk_messageBox
  5501.      tk_optionMenu tk_popup tk_setPalette tkerror tkvars tkwait toplevel
  5502.      winfo wm
  5503.      ))
  5504.    */
  5505.   /\b(Http|Tcl|a(fter|ppend|rray)\
  5506. |b(ell|gerror|i(nd(|tags)|tmap)|reak|utton)\
  5507. |c(a(nvas|se|tch)|d|heckbutton|l(ipboard|ock)|on(cat|tinue))|destroy\
  5508. |e(ntry|of|rror|v(al|ent)|x(ec|it|pr))\
  5509. |f(blocked|configure|ile(|event|name)|lush|o(cus|nt|r(|each|mat))|rame)\
  5510. |g(ets|lob(|al)|r(ab|id))|history|i(f|mage|n(cr|fo|terp))|join\
  5511. |l(a(bel|ppend)|i(brary|n(dex|sert)|st(|box))|length|o(ad|se|wer)\
  5512. |r(ange|eplace)|s(earch|ort))\
  5513. |me(nu(|button)|ssage)|op(en|tion(|s))\
  5514. |p(ack(|age)|hoto|id|kg_mkIndex|lace|roc|uts|wd)\
  5515. |r(a(diobutton|ise)|e(ad|g(exp|sub)|name|turn))\
  5516. |s(c(a(le|n)|rollbar)|e(ek|lection|nd|t)|o(cket|urce)|plit|tring|ubst\
  5517. |witch)\
  5518. |t(clvars|e(ll|xt)|ime\
  5519. |k(\
  5520. |_(bi(ndForTraversal|sque)|chooseColor|dialog\
  5521. |focus(FollowsMouse|Next|Prev)|get(OpenFile|SaveFile)\
  5522. |me(nuBar|ssageBox)|optionMenu|popup|setPalette)\
  5523. |error|vars|wait)\
  5524. |oplevel|race)\
  5525. |u(n(known|set)|p(date|level|var))|vwait|w(hile|info|m))\b/ {
  5526.     keyword_face (true);
  5527.     language_print ($0);
  5528.     keyword_face (false);
  5529.   }
  5530.   LANGUAGE_SPECIALS {
  5531.     language_print ($0);
  5532.   }
  5533. }
  5534.  
  5535.  
  5536. /**
  5537.  * Name: verilog
  5538.  * Description: Verilog hardware description language
  5539.  * Author: Edward Arthur <eda@ultranet.com>
  5540.  */
  5541. state verilog
  5542. {
  5543.   BEGIN {
  5544.     header ();
  5545.   }
  5546.   END {
  5547.     trailer ();
  5548.   }
  5549.  
  5550.   /* Verilog takes C++ style comments */
  5551.  
  5552.   /* Comments. */
  5553.   /\/\*/ {
  5554.     comment_face (true);
  5555.     language_print ($0);
  5556.     call (c_comment);
  5557.     comment_face (false);
  5558.   }
  5559.   /\/\// {
  5560.     comment_face (true);
  5561.     language_print ($0);
  5562.     call (eat_one_line);
  5563.     comment_face (false);
  5564.   }
  5565.  
  5566.   /* String constants. */
  5567.   /\"/ {
  5568.     string_face (true);
  5569.     language_print ($0);
  5570.     call (c_string);
  5571.     string_face (false);
  5572.   }
  5573.  
  5574.   /* Macro expansions start with '`' and continue one word. */
  5575.   /`([a-zA-Z_0-9]+)/ {
  5576.     reference_face (true);
  5577.     language_print ($0);
  5578.     reference_face (false);
  5579.   }
  5580.  
  5581.   /* Keywords.
  5582.      (build-re '(always and assign begin buf bufif0 bufif1 case casex
  5583.      casez cmos deassign default defparam disable edge else end endcase
  5584.      endmodule endfunction endprimitive endspecify endtable endtask event
  5585.      for force forever fork function highz0 highz1 if initial inout input
  5586.      integer join large macromodule medium module nand negedge nmos nor
  5587.      not notif0 notif1 or output parameter pmos posedge primitive pull0
  5588.      pull1 pullup pulldown rcmos reg release repeat rnmos rpmos rtran
  5589.      rtranif0 rtranif1 scalared small specify specparam strength strong0
  5590.      strong1 supply0 supply1 table task time tran tranif0 tranif1 tri tri0
  5591.      tri1 triand trior trireg vectored wait wand weak0 weak1 while wire wor
  5592.      xnor xor
  5593.      $bitstoreal $countdrivers $display $fclose $fdisplay $fmonitor
  5594.      $fopen $fstrobe $fwrite $finish $getpattern $history $incsave $input
  5595.      $itor $key $list $log $monitor $monitoroff $monitoron $nokey $nolog
  5596.      $printtimescale $readmemb $readmemh $realtime $realtobits $reset
  5597.      $reset_count $reset_value $restart $rtoi $save $scale $scope
  5598.      $showscopes $showvariables $showvars $sreadmemb $sreadmemh $stime
  5599.      $stop $strobe $time $timeformat $write $vcdpluson $vcdplusoff
  5600.      $vcdplustraceon $vcdplustraceoff $dumpvars
  5601.      ;; prefix G stands for grave `
  5602.      Gaccelerate Gautoexpand_vectornets Gcelldefine Gdefault_nettype Gdefine
  5603.      Gelse Gendcelldefine Gendif Gendprotect Gendprotected
  5604.      Gexpand_vectornets Gifdef Ginclude Gnoaccelerate
  5605.      Gnoexpand_vectornets Gnoremove_gatenames Gnoremove_netnames
  5606.      Gnounconnected_drive Gprotect Gprotected Gremove_gatenames
  5607.      Gremove_netnames Gresetall Gtimescale Gunconnected_drive
  5608.      Guselib
  5609.      ))
  5610.    */
  5611.   /\$(bitstoreal|countdrivers|d(isplay|umpvars)\
  5612. |f(close|display|inish|monitor|open|strobe|write)|getpattern|history\
  5613. |i(n(csave|put)|tor)|key|l(ist|og)|monitor(|o(ff|n))|no(key|log)\
  5614. |printtimescale\
  5615. |r(e(a(dmem(b|h)|lt(ime|obits))|s(et(|_(count|value))|tart))|toi)\
  5616. |s(ave|c(ale|ope)|how(scopes|var(iables|s))|readmem(b|h)|t(ime|op|robe))\
  5617. |time(|format)|vcdplus(o(ff|n)|traceo(ff|n))|write)\b\
  5618. |`(a(ccelerate|utoexpand_vectornets)|celldefine|def(ault_nettype|ine)\
  5619. |e(lse|nd(celldefine|if|protect(|ed))|xpand_vectornets)|i(fdef|nclude)\
  5620. |no(accelerate|expand_vectornets|remove_(gatenames|netnames)\
  5621. |unconnected_drive)\
  5622. |protect(|ed)|re(move_(gatenames|netnames)|setall)|timescale\
  5623. |u(nconnected_drive|selib))\b\
  5624. |\b(a(lways|nd|ssign)|b(egin|uf(|if(0|1)))|c(ase(|x|z)|mos)\
  5625. |d(e(assign|f(ault|param))|isable)\
  5626. |e(dge|lse|nd(|case|function|module|primitive|specify|ta(ble|sk))|vent)\
  5627. |f(or(|ce|ever|k)|unction)|highz(0|1)|i(f|n(itial|out|put|teger))|join\
  5628. |large|m(acromodule|edium|odule)|n(and|egedge|mos|o(r|t(|if(0|1))))\
  5629. |o(r|utput)|p(arameter|mos|osedge|rimitive|ull(0|1|down|up))\
  5630. |r(cmos|e(g|lease|peat)|nmos|pmos|tran(|if(0|1)))\
  5631. |s(calared|mall|pec(ify|param)|tr(ength|ong(0|1))|upply(0|1))\
  5632. |t(a(ble|sk)|ime|r(an(|if(0|1))|i(|0|1|and|or|reg)))|vectored\
  5633. |w(a(it|nd)|eak(0|1)|hile|ire|or)|x(nor|or))\b/ {
  5634.     keyword_face (true);
  5635.     language_print ($0);
  5636.     keyword_face (false);
  5637.   }
  5638.  
  5639.   LANGUAGE_SPECIALS {
  5640.     language_print ($0);
  5641.   }
  5642. }
  5643.  
  5644.  
  5645. /**
  5646.  * Name: vhdl
  5647.  * Description: VHSIC Hardware Description Language (VHDL)
  5648.  *        Highlights keywords, comments and special vhdl
  5649.  *        constructs.  Please send comments or suggestions.
  5650.  *
  5651.  * Author: Brian Silveira (brian@nortel.ca)
  5652.  *
  5653.  */
  5654. state vhdl
  5655. {
  5656.   BEGIN {
  5657.     header ();
  5658.   }
  5659.   END {
  5660.     trailer ();
  5661.   }
  5662.  
  5663.   /* Comments. */
  5664.   /--/ {
  5665.     comment_face (true);
  5666.     language_print ($0);
  5667.     call (eat_one_line);
  5668.     comment_face (false);
  5669.   }
  5670.  
  5671.   /* String constants. */
  5672.   /\"/ {
  5673.     string_face (true);
  5674.     language_print ($0);
  5675.     call (c_string);
  5676.     string_face (false);
  5677.   }
  5678.  
  5679.   /* Keywords.
  5680.      (build-re '(abs access after alias all and architecture array
  5681.      assert attribute begin begin block body body buffer bus case
  5682.      component configuration configuration constant disconnect downto
  5683.      else elsif end entity exit file for function function generate
  5684.      generic guarded if in inout is label library linkage loop map
  5685.      mod nand new next nor not null of on open or others out package
  5686.      port procedure process range record register rem report return
  5687.      reverse select severity signal subtype then to transport type
  5688.      units until use variable wait when while with with xor)
  5689.      t)
  5690.    */
  5691.   /\b([aA]([bB][sS]|[cC][cC][eE][sS][sS]|[fF][tT][eE][rR]\
  5692. |[lL]([iI][aA][sS]|[lL])|[nN][dD]\
  5693. |[rR]([cC][hH][iI][tT][eE][cC][tT][uU][rR][eE]|[rR][aA][yY])\
  5694. |[sS][sS][eE][rR][tT]|[tT][tT][rR][iI][bB][uU][tT][eE])\
  5695. |[bB]([eE][gG][iI][nN]()|[lL][oO][cC][kK]|[oO][dD][yY]()\
  5696. |[uU]([fF][fF][eE][rR]|[sS]))\
  5697. |[cC]([aA][sS][eE]\
  5698. |[oO]([mM][pP][oO][nN][eE][nN][tT]\
  5699. |[nN]([fF][iI][gG][uU][rR][aA][tT][iI][oO][nN]()|[sS][tT][aA][nN][tT])))\
  5700. |[dD]([iI][sS][cC][oO][nN][nN][eE][cC][tT]|[oO][wW][nN][tT][oO])\
  5701. |[eE]([lL][sS]([eE]|[iI][fF])|[nN]([dD]|[tT][iI][tT][yY])|[xX][iI][tT])\
  5702. |[fF]([iI][lL][eE]|[oO][rR]|[uU][nN][cC][tT][iI][oO][nN]())\
  5703. |[gG]([eE][nN][eE][rR]([aA][tT][eE]|[iI][cC])|[uU][aA][rR][dD][eE][dD])\
  5704. |[iI]([fF]|[nN](|[oO][uU][tT])|[sS])\
  5705. |[lL]([aA][bB][eE][lL]|[iI]([bB][rR][aA][rR][yY]|[nN][kK][aA][gG][eE])\
  5706. |[oO][oO][pP])\
  5707. |[mM]([aA][pP]|[oO][dD])\
  5708. |[nN]([aA][nN][dD]|[eE]([wW]|[xX][tT])|[oO]([rR]|[tT])|[uU][lL][lL])\
  5709. |[oO]([fF]|[nN]|[pP][eE][nN]|[rR]|[tT][hH][eE][rR][sS]|[uU][tT])\
  5710. |[pP]([aA][cC][kK][aA][gG][eE]|[oO][rR][tT]\
  5711. |[rR][oO][cC][eE]([dD][uU][rR][eE]|[sS][sS]))\
  5712. |[rR]([aA][nN][gG][eE]\
  5713. |[eE]([cC][oO][rR][dD]|[gG][iI][sS][tT][eE][rR]|[mM]|[pP][oO][rR][tT]\
  5714. |[tT][uU][rR][nN]|[vV][eE][rR][sS][eE]))\
  5715. |[sS]([eE]([lL][eE][cC][tT]|[vV][eE][rR][iI][tT][yY])|[iI][gG][nN][aA][lL]\
  5716. |[uU][bB][tT][yY][pP][eE])\
  5717. |[tT]([hH][eE][nN]|[oO]|[rR][aA][nN][sS][pP][oO][rR][tT]|[yY][pP][eE])\
  5718. |[uU]([nN]([iI][tT][sS]|[tT][iI][lL])|[sS][eE])\
  5719. |[vV][aA][rR][iI][aA][bB][lL][eE]\
  5720. |[wW]([aA][iI][tT]|[hH]([eE][nN]|[iI][lL][eE])|[iI][tT][hH]())\
  5721. |[xX][oO][rR])\b/ {
  5722.     keyword_face (true);
  5723.     language_print ($0);
  5724.     keyword_face (false);
  5725.   }
  5726.  
  5727.   LANGUAGE_SPECIALS {
  5728.     language_print ($0);
  5729.   }
  5730.  
  5731.  
  5732.   /<=|=>/
  5733.     {
  5734.       reference_face (true);
  5735.       language_print ($0);
  5736.       reference_face(false);
  5737.     }
  5738. }
  5739.  
  5740.  
  5741. /**
  5742.  * Name: vba
  5743.  * Description: Visual Basic (for Applications)
  5744.  * Author: Kevin Grover <grover@wizard.com>
  5745.  */
  5746.  
  5747. /* To Do
  5748.  * - ?Get parser to work for X.X.X.X and not hilight separate Xs
  5749.  * - ?recognize type declaration characters ($,%,@, etc.. on variables)
  5750.  * - ?Look for line numbers/labels (for Goto's)  /^\s*[0-9A-Za-z]+:/
  5751.  */
  5752.  
  5753. state vba
  5754. {
  5755.   BEGIN {
  5756.     header ();
  5757.   }
  5758.   END {
  5759.     trailer ();
  5760.   }
  5761.  
  5762.   /* Comments. */
  5763.   /[\']|^\s*Rem/ {
  5764.     comment_face (true);
  5765.     language_print ($0);
  5766.     call (eat_one_line);
  5767.     comment_face (false);
  5768.   }
  5769.  
  5770.   /* String constants. */
  5771.   /\".*\"/ {
  5772.     string_face (true);
  5773.     language_print ($0);
  5774.     string_face (false);
  5775.   }
  5776.  
  5777.   /* Keywords. From:
  5778.            Excel for Windows 95 Power Programming with VGA
  5779.            2nd Ed, John Walkenbach, pg 160
  5780.  
  5781.      (build-re '(
  5782.      Abs And Any As Boolean ByRef ByVal Call Case CBool CCur CDate
  5783.      CDbl CDecl CInt Circle CLng Close Const CSng CStr CurDirrase
  5784.      Currency CVar CVDate CVErr Date Debug Declare
  5785.  
  5786.      DefBool DefCur DefDate DefDbl DefInt DefLng DefObj DefSng DefStr
  5787.      DefVar Dim Dir Do Double Each Else ElsIf Empty End EndIf Eqv Erase
  5788.      Error Exit False Fix For Format FreeFile
  5789.  
  5790.      Function Get Global GoSub GoTo If Imp In Input InputB Instr InstrB Int
  5791.      Integer Is LBound Len LenB Let Like Line Load Local Lock Long Loop
  5792.      LSet Me Mid
  5793.  
  5794.      MidB Mod Name New Next Not Nothing Null Object On Open Option Optional
  5795.      Or Point Preserve Print Private Property PSet Public Put ReDim Rem
  5796.      Resume Return RSet Scale Seek
  5797.  
  5798.      Select Set Sgn Shared Single Spc Static Stop StrComp String Sub Tab
  5799.      Then TO True Type TypeOf UBound Unload Unlock Until Variant Wend While
  5800.      Width With Write Xor))
  5801.   */
  5802.   /\b(A(bs|n(d|y)|s)|B(oolean|y(Ref|Val))\
  5803. |C(Bool|Cur|D(ate|bl|ecl)|Int|Lng|S(ng|tr)|V(Date|Err|ar)|a(ll|se)|ircle\
  5804. |lose|onst|ur(Dirrase|rency))\
  5805. |D(ate|e(bug|clare|f(Bool|Cur|D(ate|bl)|Int|Lng|Obj|S(ng|tr)|Var))\
  5806. |i(m|r)|o(|uble))\
  5807. |E(ach|ls(If|e)|mpty|nd(|If)|qv|r(ase|ror)|xit)\
  5808. |F(alse|ix|or(|mat)|reeFile|unction)|G(et|lobal|o(Sub|To))\
  5809. |I(f|mp|n(|put(|B)|str(|B)|t(|eger))|s)\
  5810. |L(Bound|Set|e(n(|B)|t)|i(ke|ne)|o(ad|c(al|k)|ng|op))|M(e|id(|B)|od)\
  5811. |N(ame|e(w|xt)|ot(|hing)|ull)|O(bject|n|p(en|tion(|al))|r)\
  5812. |P(Set|oint|r(eserve|i(nt|vate)|operty)|u(blic|t))\
  5813. |R(Set|e(Dim|m|sume|turn))\
  5814. |S(cale|e(ek|lect|t)|gn|hared|ingle|pc|t(atic|op|r(Comp|ing))|ub)\
  5815. |T(O|ab|hen|rue|ype(|Of))|U(Bound|n(lo(ad|ck)|til))|Variant\
  5816. |W(end|hile|i(dth|th)|rite)|Xor)\b/ {
  5817.     keyword_face (true);
  5818.     language_print ($0);
  5819.     keyword_face (false);
  5820.   }
  5821.  
  5822.   LANGUAGE_SPECIALS {
  5823.     language_print ($0);
  5824.   }
  5825. }
  5826.  
  5827.  
  5828. /*
  5829. Local variables:
  5830. mode: c
  5831. End:
  5832. */
  5833.